Skip to content

Commit 5aee52c

Browse files
Tom Rixmartinkpetersen
authored andcommitted
scsi: scsi_transport_spi: Fix function pointer check
clang static analysis flags several null function pointer problems. drivers/scsi/scsi_transport_spi.c:374:1: warning: Called function pointer is null (null dereference) [core.CallAndMessage] spi_transport_max_attr(offset, "%d\n"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reviewing the store_spi_store_max macro if (i->f->set_##field) return -EINVAL; should be if (!i->f->set_##field) return -EINVAL; Link: https://lore.kernel.org/r/[email protected] Reviewed-by: James Bottomley <[email protected]> Signed-off-by: Tom Rix <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 311950f commit 5aee52c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/scsi_transport_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ store_spi_transport_##field(struct device *dev, \
339339
struct spi_transport_attrs *tp \
340340
= (struct spi_transport_attrs *)&starget->starget_data; \
341341
\
342-
if (i->f->set_##field) \
342+
if (!i->f->set_##field) \
343343
return -EINVAL; \
344344
val = simple_strtoul(buf, NULL, 0); \
345345
if (val > tp->max_##field) \

0 commit comments

Comments
 (0)