summaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-01-12 17:48:18 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-01-12 17:48:18 -0500
commita759012e5f9717a69c2c2f03d6c7fe435e150824 (patch)
tree4b44266e68b2047fd676201bea70f6de39a647b3 /drivers/pnp
parentbcc7201a91176f815f48f8ad889a20c5c829d9a9 (diff)
parentd8254e0e72c8cc6131f789f8645338b719f57648 (diff)
Merge branch 'pnp'
* pnp: PNPBIOS: check return value of pnp_add_device() PNP: Mark the function pnp_build_option() as static in resource.c PNP / card: add missing put_device() call PNPACPI: check return value of pnp_add_device()
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/card.c1
-rw-r--r--drivers/pnp/pnpacpi/core.c11
-rw-r--r--drivers/pnp/pnpbios/core.c12
-rw-r--r--drivers/pnp/resource.c2
4 files changed, 20 insertions, 6 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index bc00693d0c79..874c236ac1a7 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -239,6 +239,7 @@ int pnp_add_card(struct pnp_card *card)
239 error = device_register(&card->dev); 239 error = device_register(&card->dev);
240 if (error) { 240 if (error) {
241 dev_err(&card->dev, "could not register (err=%d)\n", error); 241 dev_err(&card->dev, "could not register (err=%d)\n", error);
242 put_device(&card->dev);
242 return error; 243 return error;
243 } 244 }
244 245
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 156d14e2587e..9f611cbbc294 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -241,6 +241,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
241 struct pnp_dev *dev; 241 struct pnp_dev *dev;
242 char *pnpid; 242 char *pnpid;
243 struct acpi_hardware_id *id; 243 struct acpi_hardware_id *id;
244 int error;
244 245
245 /* Skip devices that are already bound */ 246 /* Skip devices that are already bound */
246 if (device->physical_node_count) 247 if (device->physical_node_count)
@@ -299,10 +300,16 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
299 /* clear out the damaged flags */ 300 /* clear out the damaged flags */
300 if (!dev->active) 301 if (!dev->active)
301 pnp_init_resources(dev); 302 pnp_init_resources(dev);
302 pnp_add_device(dev); 303
304 error = pnp_add_device(dev);
305 if (error) {
306 put_device(&dev->dev);
307 return error;
308 }
309
303 num++; 310 num++;
304 311
305 return AE_OK; 312 return 0;
306} 313}
307 314
308static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle, 315static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 9b86a01af631..074569e77d22 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -312,18 +312,19 @@ static int __init insert_device(struct pnp_bios_node *node)
312 struct list_head *pos; 312 struct list_head *pos;
313 struct pnp_dev *dev; 313 struct pnp_dev *dev;
314 char id[8]; 314 char id[8];
315 int error;
315 316
316 /* check if the device is already added */ 317 /* check if the device is already added */
317 list_for_each(pos, &pnpbios_protocol.devices) { 318 list_for_each(pos, &pnpbios_protocol.devices) {
318 dev = list_entry(pos, struct pnp_dev, protocol_list); 319 dev = list_entry(pos, struct pnp_dev, protocol_list);
319 if (dev->number == node->handle) 320 if (dev->number == node->handle)
320 return -1; 321 return -EEXIST;
321 } 322 }
322 323
323 pnp_eisa_id_to_string(node->eisa_id & PNP_EISA_ID_MASK, id); 324 pnp_eisa_id_to_string(node->eisa_id & PNP_EISA_ID_MASK, id);
324 dev = pnp_alloc_dev(&pnpbios_protocol, node->handle, id); 325 dev = pnp_alloc_dev(&pnpbios_protocol, node->handle, id);
325 if (!dev) 326 if (!dev)
326 return -1; 327 return -ENOMEM;
327 328
328 pnpbios_parse_data_stream(dev, node); 329 pnpbios_parse_data_stream(dev, node);
329 dev->active = pnp_is_active(dev); 330 dev->active = pnp_is_active(dev);
@@ -342,7 +343,12 @@ static int __init insert_device(struct pnp_bios_node *node)
342 if (!dev->active) 343 if (!dev->active)
343 pnp_init_resources(dev); 344 pnp_init_resources(dev);
344 345
345 pnp_add_device(dev); 346 error = pnp_add_device(dev);
347 if (error) {
348 put_device(&dev->dev);
349 return error;
350 }
351
346 pnpbios_interface_attach_device(node); 352 pnpbios_interface_attach_device(node);
347 353
348 return 0; 354 return 0;
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index d95e101ffb43..bacddd102ae9 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -31,7 +31,7 @@ static int pnp_reserve_mem[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some
31 * option registration 31 * option registration
32 */ 32 */
33 33
34struct pnp_option *pnp_build_option(struct pnp_dev *dev, unsigned long type, 34static struct pnp_option *pnp_build_option(struct pnp_dev *dev, unsigned long type,
35 unsigned int option_flags) 35 unsigned int option_flags)
36{ 36{
37 struct pnp_option *option; 37 struct pnp_option *option;