aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/card.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-12-06 23:35:33 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:31 -0500
commitbfc7ee207078e8ca51264355805e6f56b485be4b (patch)
treefe06871e1a6e83ed13b50aa2cef827a6f10b0ade /drivers/pnp/card.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/card.c')
-rw-r--r--drivers/pnp/card.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index 227600cd6360..91c047a7e635 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -164,9 +164,17 @@ static DEVICE_ATTR(card_id,S_IRUGO,pnp_show_card_ids,NULL);
164 164
165static int pnp_interface_attach_card(struct pnp_card *card) 165static int pnp_interface_attach_card(struct pnp_card *card)
166{ 166{
167 device_create_file(&card->dev,&dev_attr_name); 167 int rc = device_create_file(&card->dev,&dev_attr_name);
168 device_create_file(&card->dev,&dev_attr_card_id); 168 if (rc) return rc;
169
170 rc = device_create_file(&card->dev,&dev_attr_card_id);
171 if (rc) goto err_name;
172
169 return 0; 173 return 0;
174
175err_name:
176 device_remove_file(&card->dev,&dev_attr_name);
177 return rc;
170} 178}
171 179
172/** 180/**
@@ -306,16 +314,20 @@ found:
306 down_write(&dev->dev.bus->subsys.rwsem); 314 down_write(&dev->dev.bus->subsys.rwsem);
307 dev->card_link = clink; 315 dev->card_link = clink;
308 dev->dev.driver = &drv->link.driver; 316 dev->dev.driver = &drv->link.driver;
309 if (pnp_bus_type.probe(&dev->dev)) { 317 if (pnp_bus_type.probe(&dev->dev))
310 dev->dev.driver = NULL; 318 goto err_out;
311 dev->card_link = NULL; 319 if (device_bind_driver(&dev->dev))
312 up_write(&dev->dev.bus->subsys.rwsem); 320 goto err_out;
313 return NULL; 321
314 }
315 device_bind_driver(&dev->dev);
316 up_write(&dev->dev.bus->subsys.rwsem); 322 up_write(&dev->dev.bus->subsys.rwsem);
317 323
318 return dev; 324 return dev;
325
326err_out:
327 dev->dev.driver = NULL;
328 dev->card_link = NULL;
329 up_write(&dev->dev.bus->subsys.rwsem);
330 return NULL;
319} 331}
320 332
321/** 333/**