scsi_register return code check
Subsystems (3)
PATCH 1/1 scsi_register return code check
Audited return codes for scsi_register and found only 2 defaulters
Tested with
- allmodconfig
- Tweaking Kconfig to make sure the changes do not produce any errors/warnings
--- drivers/scsi/gdth.c | 9 +++++++++ drivers/scsi/mac_scsi.c | 4 ++++ include/linux/utsrelease.h | 1 + 3 files changed, 14 insertions(+)
---
drivers/scsi/gdth.c +9 -0
@@ -4440,6 +4440,9 @@ static int __init gdth_detect(Scsi_Host_/* register addit. SCSI channels as virtual controllers */ for (b =1 ; b < ha->bus_cnt +1 ; ++b) { shp =scsi_register (shtp,sizeof (gdth_num_str)); +if (shp =NULL ) +continue ; + shp->unchecked_isa_dma =1 ; shp->irq = ha->irq; shp->dma_channel = ha->drq;
@@ -4564,6 +4567,9 @@ static int __init gdth_detect(Scsi_Host_/* register addit. SCSI channels as virtual controllers */ for (b =1 ; b < ha->bus_cnt +1 ; ++b) { shp =scsi_register (shtp,sizeof (gdth_num_str)); +if (shp =NULL ) +continue ; + shp->unchecked_isa_dma =0 ; shp->irq = ha->irq; shp->dma_channel =0xff ;
@@ -4703,6 +4709,9 @@ static int __init gdth_detect(Scsi_Host_/* register addit. SCSI channels as virtual controllers */ for (b =1 ; b < ha->bus_cnt +1 ; ++b) { shp =scsi_register (shtp,sizeof (gdth_num_str)); +if (shp =NULL ) +continue ; + shp->unchecked_isa_dma =0 ; shp->irq = ha->irq; shp->dma_channel =0xff ;
drivers/scsi/mac_scsi.c +4 -0
@@ -265,6 +265,10 @@ int macscsi_detect(struct scsi_host_temp/* Once we support multiple 5380s (e.g. DuoDock) we'll do something different here */ instance =scsi_register (tpnt,sizeof (struct NCR5380_hostdata )); +if (instance =NULL ) { +printk (KERN_ERR "mac_scsi: scsi_register failed.\n" ); +return 0 ; + }#if NDEBUG default_instance = instance;#endif
include/linux/utsrelease.h +1 -0
@@ -0,0 +1 @@ +#define UTS_RELEASE "2.6.18-rc6"
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 18 lines · Amol Lad
Audited return codes for
scsi_registerand found only 2 defaultersTested with
- allmodconfig
- TweakingKconfigto make sure the changes do not produce any errors/warningsSigned-off-by Amol Lad <[email protected]>---
drivers/scsi/gdth.c | 9 +++++++++ drivers/scsi/mac_scsi.c | 4 ++++ include/linux/utsrelease.h | 1 + 3 files changed, 14 insertions(+)---
diff -uprN -X linux-2.6.18-rc6-orig/Documentation/dontdifflinux-2.6.18-rc6-orig/drivers/scsi/gdth.clinux-2.6.18-rc6/drivers/scsi/gdth.c
drivers/scsi/gdth.c static int __init gdth_detect(Scsi_Host_ · line 4445
Quoted 6 lines
drivers/scsi/gdth.c +1
-0@@ -4440,6 +4440,9 @@ static int __init gdth_detect(Scsi_Host_/* register addit. SCSI channels as virtual controllers */ for (b =1 ; b < ha->bus_cnt +1 ; ++b) { shp =scsi_register (shtp,sizeof (gdth_num_str)); +if (shp =NULL )
Think it should be "if (!shp)".
drivers/scsi/gdth.c static int __init gdth_detect(Scsi_Host_ · line 4572
Quoted 12 lines
drivers/scsi/gdth.c +2
-0+continue ; + shp->unchecked_isa_dma =1 ;shp->irq = ha->irq; shp->dma_channel = ha->drq;drivers/scsi/gdth.c +1
-0@@ -4564,6 +4567,9 @@ static int __init gdth_detect(Scsi_Host_/* register addit. SCSI channels as virtual controllers */ for (b =1 ; b < ha->bus_cnt +1 ; ++b) { shp =scsi_register (shtp,sizeof (gdth_num_str)); +if (shp =NULL )
and here
drivers/scsi/gdth.c static int __init gdth_detect(Scsi_Host_ · line 4714
Quoted 12 lines
drivers/scsi/gdth.c +2
-0+continue ; + shp->unchecked_isa_dma =0 ;shp->irq = ha->irq; shp->dma_channel = 0xff;drivers/scsi/gdth.c +1
-0@@ -4703,6 +4709,9 @@ static int __init gdth_detect(Scsi_Host_/* register addit. SCSI channels as virtual controllers */ for (b =1 ; b < ha->bus_cnt +1 ; ++b) { shp =scsi_register (shtp,sizeof (gdth_num_str)); +if (shp =NULL )
and here
Quoted 9 lines
drivers/scsi/gdth.c +2
-0+continue ; + shp->unchecked_isa_dma =0 ;shp->irq = ha->irq; shp->dma_channel = 0xff;diff -uprN -X linux-2.6.18-rc6-orig/Documentation/dontdiff
linux-2.6.18-rc6-orig/drivers/scsi/mac_scsi.clinux-2.6.18-rc6/drivers/scsi/mac_scsi.c
drivers/scsi/mac_scsi.c int macscsi_detect(struct scsi_host_temp · line 270
Quoted 6 lines
drivers/scsi/mac_scsi.c +1
-0@@ -265,6 +265,10 @@ int macscsi_detect(struct scsi_host_temp/* Once we support multiple 5380s (e.g. DuoDock) we'll do something different here */ instance =scsi_register (tpnt,sizeof (struct NCR5380_hostdata )); +if (instance =NULL ) {
and "if (!instance) {"
include/linux/utsrelease.h line 1
Quoted 13 lines
drivers/scsi/mac_scsi.c +3
-0+printk (KERN_ERR "mac_scsi: scsi_register failed.\n" ); +return 0 ; + }#if NDEBUG default_instance = instance;#endif
diff -uprN -X linux-2.6.18-rc6-orig/Documentation/dontdifflinux-2.6.18-rc6-orig/include/linux/utsrelease.hlinux-2.6.18-rc6/include/linux/utsrelease.hinclude/linux/utsrelease.h +1
-0@@ -0,0 +1 @@ +#define UTS_RELEASE "2.6.18-rc6"
This is an autogenerated file. For some reason it has not been included in the "dontdiff"-file.
cu
Richard Knutsson
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors