diff options
Diffstat (limited to 'drivers/pnp/card.c')
-rw-r--r-- | drivers/pnp/card.c | 30 |
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 | ||
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 | /** |