Handle sysfs, driver core errors.
Signed-off-by: Jeff Garzik <[email protected]>
---
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;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]