Skip to contentSkip to conversation

scsi_pm: passing wrong pointer to resume()

PATCH In review Dan Carpenter 2 participants 2 messages May 18, 2012 – May 19, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_pm: passing wrong pointer to resume()

This gets caught by GCC:
drivers/scsi/scsi_pm.c:30:5: warning: passing argument 1 of
‘scsi_device_resume’ from incompatible pointer type [enabled by default]

It probably would have been caught in testing as well, but it's on an error path.

---
I haven't tested this. :/ Sorry for that.

drivers/scsi/scsi_pm.c +1 -1
index 9bd2c41..d4201de 100644
@@ -27,7 +27,7 @@ static int scsi_dev_type_suspend(struct device *dev, pm_message_t msg)
 		if (drv && drv->suspend) {
 			err = drv->suspend(dev, msg);
 			if (err)
-				scsi_device_resume(dev);
+				scsi_device_resume(to_scsi_device(dev));
 		}
 	}
 	dev_dbg(dev, "scsi suspend: %d\n", err);
#2 lore raw
In reply to a message not in the archive
Quoted 9 lines

From: Dan Carpenter [[email protected]]
To: James E.J. Bottomley; Lu, Aaron
Cc: [email protected]; [email protected]; [email protected]; Alan Stern
Subject: [patch] [SCSI] scsi_pm: passing wrong pointer to resume()

This gets caught by GCC:
drivers/scsi/scsi_pm.c:30:5: warning: passing argument 1 of
‘scsi_device_resume’ from incompatible pointer type [enabled by default]

Thanks for pointing this out.
I've posted v2 the other day and James is aware of this already:
http://marc.info/?l=linux-scsi&m3706440112890&w=2

Quoted 3 lines

It probably would have been caught in testing as well, but it's on an error path.

I'm dealing with such error so developed this patch. But there are other changes too in my code, so I prepared this patch in another clean repo and made the mistake, sorry for not testing it before submit.

-Aaron

Quoted 19 lines

---
I haven't tested this. :/ Sorry for that.

drivers/scsi/scsi_pm.c +1 -1
index 9bd2c41..d4201de 100644
@@ -27,7 +27,7 @@ static int scsi_dev_type_suspend(struct device *dev, pm_message_t msg)
                if (drv && drv->suspend) {
                        err = drv->suspend(dev, msg);
                        if (err)
-                               scsi_device_resume(dev);
+                               scsi_device_resume(to_scsi_device(dev));
                }
        }
        dev_dbg(dev, "scsi suspend: %d\n", err);