aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRandy Dunlap <rdunlap@xenotime.net>2006-10-03 04:14:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:08 -0400
commit349ae23fe7379a42973bcb1c85f7d43ec583c17d (patch)
tree2f885e437a59a23f04161e9761b86a8421ab6ff7 /drivers
parent5ac24697699b394cdebac0a2329ce3af247d6a3b (diff)
[PATCH] IDE core: driver layer error checking
Check driver layer return values in IDE core. Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-probe.c25
-rw-r--r--drivers/ide/ide-proc.c22
-rw-r--r--drivers/ide/ide.c8
3 files changed, 46 insertions, 9 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 9cadf0106c6c..dad9c47ebb69 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -623,6 +623,8 @@ static void hwif_release_dev (struct device *dev)
623 623
624static void hwif_register (ide_hwif_t *hwif) 624static void hwif_register (ide_hwif_t *hwif)
625{ 625{
626 int ret;
627
626 /* register with global device tree */ 628 /* register with global device tree */
627 strlcpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE); 629 strlcpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE);
628 hwif->gendev.driver_data = hwif; 630 hwif->gendev.driver_data = hwif;
@@ -634,7 +636,10 @@ static void hwif_register (ide_hwif_t *hwif)
634 hwif->gendev.parent = NULL; 636 hwif->gendev.parent = NULL;
635 } 637 }
636 hwif->gendev.release = hwif_release_dev; 638 hwif->gendev.release = hwif_release_dev;
637 device_register(&hwif->gendev); 639 ret = device_register(&hwif->gendev);
640 if (ret < 0)
641 printk(KERN_WARNING "IDE: %s: device_register error: %d\n",
642 __FUNCTION__, ret);
638} 643}
639 644
640static int wait_hwif_ready(ide_hwif_t *hwif) 645static int wait_hwif_ready(ide_hwif_t *hwif)
@@ -884,13 +889,19 @@ int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)
884 889
885 if (hwif->present) { 890 if (hwif->present) {
886 u16 unit = 0; 891 u16 unit = 0;
892 int ret;
893
887 for (unit = 0; unit < MAX_DRIVES; ++unit) { 894 for (unit = 0; unit < MAX_DRIVES; ++unit) {
888 ide_drive_t *drive = &hwif->drives[unit]; 895 ide_drive_t *drive = &hwif->drives[unit];
889 /* For now don't attach absent drives, we may 896 /* For now don't attach absent drives, we may
890 want them on default or a new "empty" class 897 want them on default or a new "empty" class
891 for hotplug reprobing ? */ 898 for hotplug reprobing ? */
892 if (drive->present) { 899 if (drive->present) {
893 device_register(&drive->gendev); 900 ret = device_register(&drive->gendev);
901 if (ret < 0)
902 printk(KERN_WARNING "IDE: %s: "
903 "device_register error: %d\n",
904 __FUNCTION__, ret);
894 } 905 }
895 } 906 }
896 } 907 }
@@ -1409,8 +1420,14 @@ int ideprobe_init (void)
1409 if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) 1420 if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced)
1410 hwif->chipset = ide_generic; 1421 hwif->chipset = ide_generic;
1411 for (unit = 0; unit < MAX_DRIVES; ++unit) 1422 for (unit = 0; unit < MAX_DRIVES; ++unit)
1412 if (hwif->drives[unit].present) 1423 if (hwif->drives[unit].present) {
1413 device_register(&hwif->drives[unit].gendev); 1424 int ret = device_register(
1425 &hwif->drives[unit].gendev);
1426 if (ret < 0)
1427 printk(KERN_WARNING "IDE: %s: "
1428 "device_register error: %d\n",
1429 __FUNCTION__, ret);
1430 }
1414 } 1431 }
1415 } 1432 }
1416 return 0; 1433 return 0;
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 41b74b13a00c..aa049dab3d95 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -326,15 +326,24 @@ static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
326{ 326{
327 struct device *dev = &drive->gendev; 327 struct device *dev = &drive->gendev;
328 int ret = 1; 328 int ret = 1;
329 int err;
329 330
330 down_write(&dev->bus->subsys.rwsem); 331 down_write(&dev->bus->subsys.rwsem);
331 device_release_driver(dev); 332 device_release_driver(dev);
332 /* FIXME: device can still be in use by previous driver */ 333 /* FIXME: device can still be in use by previous driver */
333 strlcpy(drive->driver_req, driver, sizeof(drive->driver_req)); 334 strlcpy(drive->driver_req, driver, sizeof(drive->driver_req));
334 device_attach(dev); 335 err = device_attach(dev);
336 if (err < 0)
337 printk(KERN_WARNING "IDE: %s: device_attach error: %d\n",
338 __FUNCTION__, err);
335 drive->driver_req[0] = 0; 339 drive->driver_req[0] = 0;
336 if (dev->driver == NULL) 340 if (dev->driver == NULL) {
337 device_attach(dev); 341 err = device_attach(dev);
342 if (err < 0)
343 printk(KERN_WARNING
344 "IDE: %s: device_attach(2) error: %d\n",
345 __FUNCTION__, err);
346 }
338 if (dev->driver && !strcmp(dev->driver->name, driver)) 347 if (dev->driver && !strcmp(dev->driver->name, driver))
339 ret = 0; 348 ret = 0;
340 up_write(&dev->bus->subsys.rwsem); 349 up_write(&dev->bus->subsys.rwsem);
@@ -526,7 +535,12 @@ static int proc_print_driver(struct device_driver *drv, void *data)
526 535
527static int ide_drivers_show(struct seq_file *s, void *p) 536static int ide_drivers_show(struct seq_file *s, void *p)
528{ 537{
529 bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver); 538 int err;
539
540 err = bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver);
541 if (err < 0)
542 printk(KERN_WARNING "IDE: %s: bus_for_each_drv error: %d\n",
543 __FUNCTION__, err);
530 return 0; 544 return 0;
531} 545}
532 546
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 8c3f06242280..97b162ca9885 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1997,10 +1997,16 @@ EXPORT_SYMBOL_GPL(ide_bus_type);
1997 */ 1997 */
1998static int __init ide_init(void) 1998static int __init ide_init(void)
1999{ 1999{
2000 int ret;
2001
2000 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n"); 2002 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n");
2001 system_bus_speed = ide_system_bus_speed(); 2003 system_bus_speed = ide_system_bus_speed();
2002 2004
2003 bus_register(&ide_bus_type); 2005 ret = bus_register(&ide_bus_type);
2006 if (ret < 0) {
2007 printk(KERN_WARNING "IDE: bus_register error: %d\n", ret);
2008 return ret;
2009 }
2004 2010
2005 init_ide_data(); 2011 init_ide_data();
2006 2012