]> Pileus Git - ~andy/linux/blobdiff - drivers/pnp/pnpacpi/core.c
PNPACPI: check return value of pnp_add_device()
[~andy/linux] / drivers / pnp / pnpacpi / core.c
index 14655a0f0431b35bd9a0988b669c510a162155e3..4bd4c54ad20561650c8b3a01d87a953da66d7346 100644 (file)
@@ -242,6 +242,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
        struct pnp_dev *dev;
        char *pnpid;
        struct acpi_hardware_id *id;
+       int error;
 
        /* Skip devices that are already bound */
        if (device->physical_node_count)
@@ -300,10 +301,16 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
        /* clear out the damaged flags */
        if (!dev->active)
                pnp_init_resources(dev);
-       pnp_add_device(dev);
+
+       error = pnp_add_device(dev);
+       if (error) {
+               put_device(&dev->dev);
+               return error;
+       }
+
        num++;
 
-       return AE_OK;
+       return 0;
 }
 
 static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,