All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firewire: handle sysfs errors
@ 2006-10-10  6:48 Jeff Garzik
  2006-10-10  8:38 ` Stefan Richter
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2006-10-10  6:48 UTC (permalink / raw)
  To: bcollins, stefanr, Andrew Morton, LKML


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;
 }
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-10 19:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-10  6:48 [PATCH] firewire: handle sysfs errors Jeff Garzik
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.