* [PATCH] ACPI/AC: add check the return value of power_supply_regiester()
@ 2012-07-04 5:33 Lan Tianyu
0 siblings, 0 replies; only message in thread
From: Lan Tianyu @ 2012-07-04 5:33 UTC (permalink / raw)
To: lenb; +Cc: Lan Tianyu, linux-acpi
In the ac.c, lack check return value of power_supply_register().
This may casue that acpi driver's add() ops was called successful
while the device may be failed to be initalized. For example, some
ugly bios may describe two ACADs in the same dsdt. They use the same
name which will cause the second ACAD device can no be registered.
And then power_supply_register() failed. But acpi driver's add() ops
is called sucessfully. The acpi device also 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>
---
drivers/acpi/ac.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 6512b20..d1fcbc0 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -292,7 +292,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;
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device),
--
1.7.6.rc2.8.g28eb
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-07-04 5:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-04 5:33 [PATCH] ACPI/AC: add check the return value of power_supply_regiester() Lan Tianyu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).