[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#661995: Inspiron 1090: Panic on power event (Doubled AC adapter)

tags 661995 + upstream patch moreinfo


Giovanni Biscuolo wrote:

> "sysfs: cannot create duplicate filename '/class/power_supply/ACAD'"

Please test the attached patch against a 3.2.y kernel, for example
using the instructions below:

0. prerequisites:

	apt-get install git build-essential

1. get the kernel history, if you don't already have it:

	git clone \

2. fetch point releases:

	cd linux
	git remote add stable \
	git fetch stable

3. configure, build, test:

	git checkout stable/linux-3.2.y
	cp /boot/config-$(uname -r) .config; # current configuration
	scripts/config --disable DEBUG_INFO
	make localmodconfig; # optional: minimize configuration
	make deb-pkg; # optionally with -j<num> for parallel build
	dpkg -i ../<name of package>; # as root
	... test test test ...

   Hopefully it reproduces the bug.  So

4. try the patch:

	cd linux
	git am -3sc /path/to/the/patch
	make deb-pkg; # maybe with -j4
	dpkg -i ../<name of package>; # as root
	... test test test ...

Hope that helps,
From: Lan Tianyu <tianyu.lan@intel.com>
Date: Tue, 24 Jul 2012 23:41:45 -0400
Subject: ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check

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.


Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
 drivers/acpi/ac.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 6512b20aeccd..d1fcbc0f6cbc 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),

Reply to: