diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnp/card.c | 30 | ||||
-rw-r--r-- | drivers/pnp/interface.c | 17 |
2 files changed, 35 insertions, 12 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 | ||
165 | static int pnp_interface_attach_card(struct pnp_card *card) | 165 | static 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 | |||
175 | err_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 | |||
326 | err_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 | /** |
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); | |||
461 | 461 | ||
462 | int pnp_interface_attach_device(struct pnp_dev *dev) | 462 | int pnp_interface_attach_device(struct pnp_dev *dev) |
463 | { | 463 | { |
464 | device_create_file(&dev->dev,&dev_attr_options); | 464 | int rc = device_create_file(&dev->dev,&dev_attr_options); |
465 | device_create_file(&dev->dev,&dev_attr_resources); | 465 | if (rc) goto err; |
466 | device_create_file(&dev->dev,&dev_attr_id); | 466 | rc = device_create_file(&dev->dev,&dev_attr_resources); |
467 | if (rc) goto err_opt; | ||
468 | rc = device_create_file(&dev->dev,&dev_attr_id); | ||
469 | if (rc) goto err_res; | ||
470 | |||
467 | return 0; | 471 | return 0; |
472 | |||
473 | err_res: | ||
474 | device_remove_file(&dev->dev,&dev_attr_resources); | ||
475 | err_opt: | ||
476 | device_remove_file(&dev->dev,&dev_attr_options); | ||
477 | err: | ||
478 | return rc; | ||
468 | } | 479 | } |