Skip to content

Commit

Permalink
ACPI/AC: prevent OOPS on some boxes due to missing check power_supply…
Browse files Browse the repository at this point in the history
…_register() return value check

commit f197ac1 upstream.

In the ac.c, power_supply_register()'s return value is not checked.

As a result, the driver's add() ops may return success
even though the device failed to initialize.

For example, some BIOS may describe two ACADs in the same DSDT.
The second ACAD device will fail to register,
but ACPI driver's add() ops returns sucessfully.
The ACPI device will receive ACPI notification and cause OOPS.

https://bugzilla.redhat.com/show_bug.cgi?id=772730

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Lan Tianyu authored and bwhacks committed Aug 2, 2012
1 parent 295cc2b commit 3a928a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/acpi/ac.c
Expand Up @@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_device *device)
ac->charger.properties = ac_props; ac->charger.properties = ac_props;
ac->charger.num_properties = ARRAY_SIZE(ac_props); ac->charger.num_properties = ARRAY_SIZE(ac_props);
ac->charger.get_property = get_ac_property; ac->charger.get_property = get_ac_property;
power_supply_register(&ac->device->dev, &ac->charger); result = power_supply_register(&ac->device->dev, &ac->charger);
if (result)
goto end;


printk(KERN_INFO PREFIX "%s [%s] (%s)\n", printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device), acpi_device_name(device), acpi_device_bid(device),
Expand Down

0 comments on commit 3a928a5

Please sign in to comment.