[kernel] check return value of power_supply_register from Lan Tianyu (rhbz 772730)

Josh Boyer jwboyer at fedoraproject.org
Wed Jul 18 13:44:27 UTC 2012


commit d7721263f2c8320baef26e9e2efaa37420e0b065
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Wed Jul 18 09:12:02 2012 -0400

    check return value of power_supply_register from Lan Tianyu (rhbz 772730)

 ...the-return-value-of-power_supply_register.patch |   37 ++++++++++++++++++++
 kernel.spec                                        |   11 +++++-
 2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/ACPI-AC-check-the-return-value-of-power_supply_register.patch b/ACPI-AC-check-the-return-value-of-power_supply_register.patch
new file mode 100644
index 0000000..c9eb1a1
--- /dev/null
+++ b/ACPI-AC-check-the-return-value-of-power_supply_register.patch
@@ -0,0 +1,37 @@
+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 at 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
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
+the body of a message to majordomo at vger.kernel.org
+More majordomo info at  http://vger.kernel.org/majordomo-info.html
\ No newline at end of file
diff --git a/kernel.spec b/kernel.spec
index 5a60c60..d44cabf 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -62,7 +62,7 @@ Summary: The Linux kernel
 # For non-released -rc kernels, this will be appended after the rcX and
 # gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
 #
-%global baserelease 2
+%global baserelease 3
 %global fedora_build %{baserelease}
 
 # base_sublevel is the kernel version we're starting with and patching
@@ -749,6 +749,9 @@ Patch22043: rt2x00usb-fix-indexes-ordering-on-RX-queue-kick.patch
 Patch22050: crypto-testmgr-allow-aesni-intel-and-ghash_clmulni-intel.patch
 Patch22051: crypto-aesni-intel-fix-wrong-kfree-pointer.patch
 
+#rhbz 772730
+Patch22058: ACPI-AC-check-the-return-value-of-power_supply_register.patch
+
 # END OF PATCH DEFINITIONS
 
 %endif
@@ -1444,6 +1447,9 @@ ApplyPatch rt2x00usb-fix-indexes-ordering-on-RX-queue-kick.patch
 ApplyPatch crypto-testmgr-allow-aesni-intel-and-ghash_clmulni-intel.patch
 ApplyPatch crypto-aesni-intel-fix-wrong-kfree-pointer.patch
 
+#rhbz 772730
+ApplyPatch ACPI-AC-check-the-return-value-of-power_supply_register.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2300,6 +2306,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Wed Jul 18 2012 Josh Boyer <jwboyer at redhat.com>
+- check return value of power_supply_register from Lan Tianyu (rhbz 772730)
+
 * Tue Jul 17 2012 Justin M. Forbes <jforbes at redhat.com> - 3.5.0-0.rc7.git1.2
 - Reenable debugging options.
 


More information about the scm-commits mailing list