Linux ATA/IDE development
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rdunlap@xenotime.net>
To: linux-ide@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Cc: B.Zolnierkiewicz@elka.pw.edu.pl, akpm <akpm@osdl.org>
Subject: [PATCH -mm] IDE core: must_check fixes
Date: Tue, 11 Jul 2006 20:45:55 -0700	[thread overview]
Message-ID: <20060711204555.3b12eba4.rdunlap@xenotime.net> (raw)

From: Randy Dunlap <rdunlap@xenotime.net>

Check all __must_check warnings in IDE core.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
 drivers/ide/ide-probe.c |   25 +++++++++++++++++++++----
 drivers/ide/ide-proc.c  |   22 ++++++++++++++++++----
 drivers/ide/ide.c       |    8 +++++++-
 3 files changed, 46 insertions(+), 9 deletions(-)

--- linux-2618-rc1mm1.orig/drivers/ide/ide.c
+++ linux-2618-rc1mm1/drivers/ide/ide.c
@@ -1994,10 +1994,16 @@ EXPORT_SYMBOL_GPL(ide_bus_type);
  */
 static int __init ide_init(void)
 {
+	int ret;
+
 	printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n");
 	system_bus_speed = ide_system_bus_speed();
 
-	bus_register(&ide_bus_type);
+	ret = bus_register(&ide_bus_type);
+	if (ret < 0) {
+		printk(KERN_WARNING "IDE: bus_register error: %d\n", ret);
+		return ret;
+	}
 
 	init_ide_data();
 
--- linux-2618-rc1mm1.orig/drivers/ide/ide-probe.c
+++ linux-2618-rc1mm1/drivers/ide/ide-probe.c
@@ -623,6 +623,8 @@ static void hwif_release_dev (struct dev
 
 static void hwif_register (ide_hwif_t *hwif)
 {
+	int ret;
+
 	/* register with global device tree */
 	strlcpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE);
 	hwif->gendev.driver_data = hwif;
@@ -634,7 +636,10 @@ static void hwif_register (ide_hwif_t *h
 			hwif->gendev.parent = NULL;
 	}
 	hwif->gendev.release = hwif_release_dev;
-	device_register(&hwif->gendev);
+	ret = device_register(&hwif->gendev);
+	if (ret < 0)
+		printk(KERN_WARNING "IDE: %s: device_register error: %d\n",
+			__FUNCTION__, ret);
 }
 
 static int wait_hwif_ready(ide_hwif_t *hwif)
@@ -884,13 +889,19 @@ int probe_hwif_init_with_fixup(ide_hwif_
 
 	if (hwif->present) {
 		u16 unit = 0;
+		int ret;
+
 		for (unit = 0; unit < MAX_DRIVES; ++unit) {
 			ide_drive_t *drive = &hwif->drives[unit];
 			/* For now don't attach absent drives, we may
 			   want them on default or a new "empty" class
 			   for hotplug reprobing ? */
 			if (drive->present) {
-				device_register(&drive->gendev);
+				ret = device_register(&drive->gendev);
+				if (ret < 0)
+					printk(KERN_WARNING "IDE: %s: "
+						"device_register error: %d\n",
+						__FUNCTION__, ret);
 			}
 		}
 	}
@@ -1409,8 +1420,14 @@ int ideprobe_init (void)
 			if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced)
 				hwif->chipset = ide_generic;
 			for (unit = 0; unit < MAX_DRIVES; ++unit)
-				if (hwif->drives[unit].present)
-					device_register(&hwif->drives[unit].gendev);
+				if (hwif->drives[unit].present) {
+					int ret = device_register(
+						&hwif->drives[unit].gendev);
+					if (ret < 0)
+						printk(KERN_WARNING "IDE: %s: "
+							"device_register error: %d\n",
+							__FUNCTION__, ret);
+				}
 		}
 	}
 	return 0;
--- linux-2618-rc1mm1.orig/drivers/ide/ide-proc.c
+++ linux-2618-rc1mm1/drivers/ide/ide-proc.c
@@ -326,15 +326,24 @@ static int ide_replace_subdriver(ide_dri
 {
 	struct device *dev = &drive->gendev;
 	int ret = 1;
+	int err;
 
 	down_write(&dev->bus->subsys.rwsem);
 	device_release_driver(dev);
 	/* FIXME: device can still be in use by previous driver */
 	strlcpy(drive->driver_req, driver, sizeof(drive->driver_req));
-	device_attach(dev);
+	err = device_attach(dev);
+	if (err < 0)
+		printk(KERN_WARNING "IDE: %s: device_attach error: %d\n",
+			__FUNCTION__, err);
 	drive->driver_req[0] = 0;
-	if (dev->driver == NULL)
-		device_attach(dev);
+	if (dev->driver == NULL) {
+		err = device_attach(dev);
+		if (err < 0)
+			printk(KERN_WARNING
+				"IDE: %s: device_attach(2) error: %d\n",
+				__FUNCTION__, err);
+	}
 	if (dev->driver && !strcmp(dev->driver->name, driver))
 		ret = 0;
 	up_write(&dev->bus->subsys.rwsem);
@@ -524,7 +533,12 @@ static int proc_print_driver(struct devi
 
 static int ide_drivers_show(struct seq_file *s, void *p)
 {
-	bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver);
+	int err;
+
+	err = bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver);
+	if (err < 0)
+		printk(KERN_WARNING "IDE: %s: bus_for_each_drv error: %d\n",
+			__FUNCTION__, err);
 	return 0;
 }
 


---

             reply	other threads:[~2006-07-12  3:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-12  3:45 Randy.Dunlap [this message]
2006-07-12 12:04 ` [PATCH -mm] IDE core: must_check fixes Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060711204555.3b12eba4.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=akpm@osdl.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox