drivers/scsi/sata_vsc.c: inconsistent NULL checking
The Coverity checker found this inconsistent NULL checking recently introduced by the following commit:
2ae5b30ff08cee422c7f6388a759f7
Author: Dan Williams <[email protected]>
[PATCH] Necessary evil to get sata_vsc to initialize with Intel iq3124h hba
In function vsc_sata_interrupt():
err_status = ap ? vsc_sata_scr_read(ap, SCR_ERROR) : 0; vsc_sata_scr_write(ap, SCR_ERROR, err_status);
vsc_sata_scr_write() always dereferences ap
(since SCR_ERROR < SCR_CONTROL).
Checking for NULL in one line and unconditionally dereferencing the variable in the next line can't be right.
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 14 lines · Adrian Bunk
The Coverity checker found this inconsistent NULL checking recently introduced by the following commit:
2ae5b30ff08cee422c7f6388a759f7
Author: Dan Williams <[email protected]>
[PATCH] Necessary evil to getsata_vscto initialize with Intel iq3124h hbaIn function
vsc_sata_interrupt():err_status = ap ? vsc_sata_scr_read(ap, SCR_ERROR) : 0; vsc_sata_scr_write(ap, SCR_ERROR, err_status);
Quoted 6 lines
vsc_sata_scr_write()always dereferences ap
(sinceSCR_ERROR<SCR_CONTROL).Checking for NULL in one line and unconditionally dereferencing the variable in the next line can't be right.
The attached patch cleans up the code, and adds GD31244 to the driver description in drivers/scsi/Kconfig.
Dan
drivers/scsi/Kconfig +2 -2
@@ -587,10 +587,10 @@ config SCSI_SATA_VIA If unsure, say N. config SCSI_SATA_VITESSE - tristate "VITESSE VSC-7174 SATA support" + tristate "VITESSE VSC-7174 / INTEL 31244 SATA support" depends on SCSI_SATA && PCI help - This option enables support for Vitesse VSC7174 Serial ATA. + This option enables support for Vitesse VSC7174 and Intel 31244 Serial ATA. If unsure, say N.
drivers/scsi/sata_vsc.c +30 -21
73 lines not on this page · raw message
Quoted 4 lines
The attached patch cleans up the code, and adds GD31244 to the driver description in
drivers/scsi/Kconfig.
Joe Perches suggested some coding style changes. Here is version 2.
Dan
drivers/scsi/Kconfig +2 -2
@@ -587,10 +587,10 @@ config SCSI_SATA_VIA If unsure, say N. config SCSI_SATA_VITESSE - tristate "VITESSE VSC-7174 SATA support" + tristate "VITESSE VSC-7174 / INTEL 31244 SATA support" depends on SCSI_SATA && PCI help - This option enables support for Vitesse VSC7174 Serial ATA. + This option enables support for Vitesse VSC7174 and Intel 31244 Serial ATA. If unsure, say N.
drivers/scsi/sata_vsc.c +30 -21
73 lines not on this page · raw message
Jeff Garzik
AppliedQuoted 4 lines · Dan Williams
Quoted 2 lines
The attached patch cleans up the code, and adds GD31244 to the driver description in
drivers/scsi/Kconfig.Joe Perches suggested some coding style changes. Here is version 2.
Applied. When resending patches, please continue to follow the standard patch submission format, particularly #2, #5 and #6:
http://linux.yyz.us/patch-format.html
Regards,
Jeff