Commit 9974e43d900af7979e0a571b8e0c9674c7399b79

Authored by Miklos Szeredi
Committed by David S. Miller
1 parent 1456c75a80

ide: fix generic_ide_suspend/resume Oops

This patch fixes a regresion introduced by commit 0998d063 (device-core: Ensure
drvdata = NULL when no driver is bound).

Suspend oopses in generic_ide_suspend() because dev_get_drvdata()
returns NULL (dev->p->driver_data == NULL) and this function is not
prepared for this.

Fix is based on Alan Stern's suggestion.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

drivers/ide/ide-pm.c
... ... @@ -4,7 +4,7 @@
4 4  
5 5 int generic_ide_suspend(struct device *dev, pm_message_t mesg)
6 6 {
7   - ide_drive_t *drive = dev_get_drvdata(dev);
  7 + ide_drive_t *drive = to_ide_device(dev);
8 8 ide_drive_t *pair = ide_get_pair_dev(drive);
9 9 ide_hwif_t *hwif = drive->hwif;
10 10 struct request *rq;
... ... @@ -40,7 +40,7 @@
40 40  
41 41 int generic_ide_resume(struct device *dev)
42 42 {
43   - ide_drive_t *drive = dev_get_drvdata(dev);
  43 + ide_drive_t *drive = to_ide_device(dev);
44 44 ide_drive_t *pair = ide_get_pair_dev(drive);
45 45 ide_hwif_t *hwif = drive->hwif;
46 46 struct request *rq;