提交 249135d1 编写于 作者: D Dmitry Torokhov 提交者: Rafael J. Wysocki

PNPACPI: check return value of pnp_add_device()

pnp_add_device() may fail so we need to handle errors and avoid leaking
memory. Also, do not use ACPI-specific return codes (AE_OK) but rather
standard one (0).
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 319e2e3f
...@@ -242,6 +242,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) ...@@ -242,6 +242,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
struct pnp_dev *dev; struct pnp_dev *dev;
char *pnpid; char *pnpid;
struct acpi_hardware_id *id; struct acpi_hardware_id *id;
int error;
/* Skip devices that are already bound */ /* Skip devices that are already bound */
if (device->physical_node_count) if (device->physical_node_count)
...@@ -300,10 +301,16 @@ static int __init pnpacpi_add_device(struct acpi_device *device) ...@@ -300,10 +301,16 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
/* clear out the damaged flags */ /* clear out the damaged flags */
if (!dev->active) if (!dev->active)
pnp_init_resources(dev); pnp_init_resources(dev);
pnp_add_device(dev);
error = pnp_add_device(dev);
if (error) {
put_device(&dev->dev);
return error;
}
num++; num++;
return AE_OK; return 0;
} }
static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle, static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册