Skip to contentSkip to conversation

drivers/scsi/dpt_i2o.c: remove dead code

PATCH In review Adrian Bunk 2 participants 4 messages Oct 8, 2006 – Oct 11, 2006 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/scsi/dpt_i2o.c: remove dead code

The Coverity checker spotted this dead code introduced by commit a07f353701acae77e023f6270e8af353b37af7c4.

drivers/scsi/dpt_i2o.c renamed from drivers/scsi/dpt_i2o.c.old +0 -2
@@ -185,28 +185,26 @@
 
         /* search for all Adatpec I2O RAID cards */
 	while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
 		if(pDev->device == PCI_DPT_DEVICE_ID ||
 		   pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
 			if(adpt_install_hba(sht, pDev) ){
 				PERROR("Could not Init an I2O RAID device\n");
 				PERROR("Will not try to detect others.\n");
 				return hba_count-1;
 			}
 			pci_dev_get(pDev);
 		}
 	}
-	if (pDev)
-		pci_dev_put(pDev);
 
 	/* In INIT state, Activate IOPs */
 	for (pHba = hba_chain; pHba; pHba = pHba->next) {
 		// Activate does get status , init outbound, and get hrt
 		if (adpt_i2o_activate_hba(pHba) < 0) {
 			adpt_i2o_delete_hba(pHba);
 		}
 	}
 
 
 	/* Active IOPs in HOLD state */
 
 rebuild_sys_tab:
#1 lore raw

Ar Llu, 2006-10-09 am 01:16 +0200, ysgrifennodd Adrian Bunk:

Quoted 4 lines

The Coverity checker spotted this dead code introduced by commit a07f353701acae77e023f6270e8af353b37af7c4.

Semi-NAK

Its not dead jim, its in the wrong location

drivers/scsi/dpt_i2o.c line 192

Quoted 6 lines
drivers/scsi/dpt_i2o.c renamed from drivers/scsi/dpt_i2o.c.old +0 -0
 	while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
 		if(pDev->device == PCI_DPT_DEVICE_ID ||
 		   pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
 			if(adpt_install_hba(sht, pDev) ){
 				PERROR("Could not Init an I2O RAID device\n");
 				PERROR("Will not try to detect others.\n");

------------------------> pci_dev_put()

is needed there instead I think.

Been away so just catching up

#2 lore raw
Quoted 17 lines · Alan Cox

Ar Llu, 2006-10-09 am 01:16 +0200, ysgrifennodd Adrian Bunk:

Quoted 4 lines

The Coverity checker spotted this dead code introduced by commit a07f353701acae77e023f6270e8af353b37af7c4.

Semi-NAK

Its not dead jim, its in the wrong location

drivers/scsi/dpt_i2o.c line 192

Quoted 6 lines
drivers/scsi/dpt_i2o.c renamed from drivers/scsi/dpt_i2o.c.old +0 -0
 	while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
 		if(pDev->device == PCI_DPT_DEVICE_ID ||
 		   pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
 			if(adpt_install_hba(sht, pDev) ){
 				PERROR("Could not Init an I2O RAID device\n");
 				PERROR("Will not try to detect others.\n");
Quoted 4 lines

------------------------> pci_dev_put()

is needed there instead I think.
...

The current code is:

        /* search for all Adatpec I2O RAID cards */
        while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
                if(pDev->device == PCI_DPT_DEVICE_ID ||
                   pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
                        if(adpt_install_hba(sht, pDev) ){
                                PERROR("Could not Init an I2O RAID device\n");
                                PERROR("Will not try to detect others.\n");
                                return hba_count-1;
                        }
                        pci_dev_get(pDev);
                }
        }
        if (pDev)
                pci_dev_put(pDev);

I don't see the point of the suggested place for the pci_dev_put() since pci_dev_get() has never been executed in this case, or do I miss anything?

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 Seed
#3 lore raw
Quoted 3 lines

I don't see the point of the suggested place for the pci_dev_put() since pci_dev_get() has never been executed in this case, or do I miss anything?

Correct, thats what I get for being away and reading 4000 emails when I get back

Alan