summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLan Tianyu <tianyu.lan@intel.com>2012-07-20 13:29:16 +0800
committerWilly Tarreau <w@1wt.eu>2012-10-07 23:38:06 +0200
commitd4e89205393edf4296d2345143b73ebfe17a7531 (patch)
tree7d8e670e3ef13ecc1f3ede6c2953e154e7a5677d /drivers
parente59164b84573bc0ac55f000ffe678c4e7d22c68b (diff)
ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check
commit f197ac13f6eeb351b31250b9ab7d0da17434ea36 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/ac.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index b6ed60b57b0d..bc3f918d9dbf 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -287,7 +287,9 @@ static int acpi_ac_add(struct acpi_device *device)
ac->charger.properties = ac_props;
ac->charger.num_properties = ARRAY_SIZE(ac_props);
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;
#endif
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",