* [PATCH] I2O: handle a few sysfs errors
@ 2006-10-10 16:03 Jeff Garzik
0 siblings, 0 replies; only message in thread
From: Jeff Garzik @ 2006-10-10 16:03 UTC (permalink / raw)
To: markus.lidel, Andrew Morton, LKML
Signed-off-by: Jeff Garzik <jeff@garzik.org>
---
This was just the low-hanging fruit. There are more unchecked-return
calls in there.
drivers/message/i2o/bus-osm.c | 12 ++++++++++--
drivers/message/i2o/exec-osm.c | 17 ++++++++++++++---
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/message/i2o/bus-osm.c b/drivers/message/i2o/bus-osm.c
index ac06f10..d96c687 100644
--- a/drivers/message/i2o/bus-osm.c
+++ b/drivers/message/i2o/bus-osm.c
@@ -80,18 +80,26 @@ static DEVICE_ATTR(scan, S_IWUSR, NULL,
* @dev: device to verify if it is a I2O Bus Adapter device
*
* Because we want all Bus Adapters always return 0.
+ * Except when we fail. Then we are sad.
*
- * Returns 0.
+ * Returns 0, except when we fail to excel.
*/
static int i2o_bus_probe(struct device *dev)
{
struct i2o_device *i2o_dev = to_i2o_device(get_device(dev));
+ int rc;
- device_create_file(dev, &dev_attr_scan);
+ rc = device_create_file(dev, &dev_attr_scan);
+ if (rc)
+ goto err_out;
osm_info("device added (TID: %03x)\n", i2o_dev->lct_data.tid);
return 0;
+
+err_out:
+ put_device(dev);
+ return rc;
};
/**
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index 7bd4d85..91f95d1 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -325,13 +325,24 @@ static DEVICE_ATTR(product_id, S_IRUGO,
static int i2o_exec_probe(struct device *dev)
{
struct i2o_device *i2o_dev = to_i2o_device(dev);
+ int rc;
- i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff);
+ rc = i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff);
+ if (rc) goto err_out;
- device_create_file(dev, &dev_attr_vendor_id);
- device_create_file(dev, &dev_attr_product_id);
+ rc = device_create_file(dev, &dev_attr_vendor_id);
+ if (rc) goto err_evtreg;
+ rc = device_create_file(dev, &dev_attr_product_id);
+ if (rc) goto err_vid;
return 0;
+
+err_vid:
+ device_remove_file(dev, &dev_attr_vendor_id);
+err_evtreg:
+ i2o_event_register(to_i2o_device(dev), &i2o_exec_driver, 0, 0);
+err_out:
+ return rc;
};
/**
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-10-10 16:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-10 16:03 [PATCH] I2O: handle a few sysfs errors Jeff Garzik
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®