From: Jeff Garzik <jeff@garzik.org>
To: bcollins@debian.org, stefanr@s5r6.in-berlin.de,
Andrew Morton <akpm@osdl.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] firewire: handle sysfs errors
Date: Tue, 10 Oct 2006 02:48:05 -0400 [thread overview]
Message-ID: <20061010064805.GA21310@havoc.gtf.org> (raw)
Handle sysfs, driver core errors.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
---
drivers/ieee1394/nodemgr.c | 36 ++++++++++++++++++++++++++++--------
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 8e7b83f..8628e3f 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -414,9 +414,11 @@ static BUS_ATTR(destroy_node, S_IWUSR |
static ssize_t fw_set_rescan(struct bus_type *bus, const char *buf, size_t count)
{
+ int rc;
+
if (simple_strtoul(buf, NULL, 10) == 1)
- bus_rescan_devices(&ieee1394_bus_type);
- return count;
+ rc = bus_rescan_devices(&ieee1394_bus_type);
+ return rc < 0 ? rc : count;
}
static ssize_t fw_get_rescan(struct bus_type *bus, char *buf)
{
@@ -576,13 +578,23 @@ static struct driver_attribute *const fw
};
-static void nodemgr_create_drv_files(struct hpsb_protocol_driver *driver)
+static int nodemgr_create_drv_files(struct hpsb_protocol_driver *driver)
{
struct device_driver *drv = &driver->driver;
- int i;
+ int i, j, rc;
- for (i = 0; i < ARRAY_SIZE(fw_drv_attrs); i++)
- driver_create_file(drv, fw_drv_attrs[i]);
+ for (i = 0; i < ARRAY_SIZE(fw_drv_attrs); i++) {
+ rc = driver_create_file(drv, fw_drv_attrs[i]);
+ if (rc)
+ goto err_out;
+ }
+
+ return 0;
+
+err_out:
+ for (j = 0; j < i; j++)
+ driver_remove_file(drv, fw_drv_attrs[j]);
+ return rc;
}
@@ -1166,9 +1178,17 @@ int hpsb_register_protocol(struct hpsb_p
/* This will cause a probe for devices */
ret = driver_register(&driver->driver);
- if (!ret)
- nodemgr_create_drv_files(driver);
+ if (ret)
+ return ret;
+
+ ret = nodemgr_create_drv_files(driver);
+ if (ret)
+ goto err_out;
+
+ return 0;
+err_out:
+ driver_unregister(&driver->driver);
return ret;
}
next reply other threads:[~2006-10-10 6:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-10 6:48 Jeff Garzik [this message]
2006-10-10 8:38 ` Stefan Richter
2006-10-10 12:52 ` Jeff Garzik
2006-10-10 19:11 ` [PATCH 2.6.19-rc1 1/3] ieee1394: lock smaller region by host_num_alloc mutex Stefan Richter
2006-10-10 19:12 ` [PATCH 2.6.19-rc1 2/3] ieee1394: coding style in hosts.c Stefan Richter
2006-10-10 19:19 ` [PATCH 2.6.19-rc1 3/3] ieee1394: handle sysfs errors Stefan Richter
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=20061010064805.GA21310@havoc.gtf.org \
--to=jeff@garzik.org \
--cc=akpm@osdl.org \
--cc=bcollins@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stefanr@s5r6.in-berlin.de \
/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
all inboxes | Powered by JetHome®