summaryrefslogtreecommitdiff
path: root/drivers/pnp/interface.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-12-06 20:35:33 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 08:39:31 -0800
commitbfc7ee207078e8ca51264355805e6f56b485be4b (patch)
treefe06871e1a6e83ed13b50aa2cef827a6f10b0ade /drivers/pnp/interface.c
parent3889b26bebd3e3cf5a3b95da683bab2f6462133d (diff)
[PATCH] PNP: handle sysfs errors
Signed-off-by: Jeff Garzik <jeff@garzik.org> Cc: Adam Belay <ambx1@neo.rr.com> Cc: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pnp/interface.c')
-rw-r--r--drivers/pnp/interface.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 9d8b415eca79..ac9fcd499f3f 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -461,8 +461,19 @@ static DEVICE_ATTR(id,S_IRUGO,pnp_show_current_ids,NULL);
int pnp_interface_attach_device(struct pnp_dev *dev)
{
- device_create_file(&dev->dev,&dev_attr_options);
- device_create_file(&dev->dev,&dev_attr_resources);
- device_create_file(&dev->dev,&dev_attr_id);
+ int rc = device_create_file(&dev->dev,&dev_attr_options);
+ if (rc) goto err;
+ rc = device_create_file(&dev->dev,&dev_attr_resources);
+ if (rc) goto err_opt;
+ rc = device_create_file(&dev->dev,&dev_attr_id);
+ if (rc) goto err_res;
+
return 0;
+
+err_res:
+ device_remove_file(&dev->dev,&dev_attr_resources);
+err_opt:
+ device_remove_file(&dev->dev,&dev_attr_options);
+err:
+ return rc;
}