[Lucid][Precise][Quantal][SRU][Patch] UBUNTU: SAUCE: ACPI battery: fix compiler warning

Luis Henriques luis.henriques at canonical.com
Fri Nov 1 15:45:12 UTC 2013

BugLink: http://bugs.launchpad.net/bugs/1247154

This patch fixes the following compiler warning:

/home/henrix/src/precise/ubuntu-precise/drivers/acpi/battery.c: In function 'acpi_battery_init':
/home/henrix/src/precise/ubuntu-precise/drivers/acpi/battery.c:1172:3: warning: 'return' with no value, in function returning non-void [-Wreturn-type]

This could cause problems because, if ACPI is disabled, the driver
init function would return 0 (success) without being initialised.

This issue was introduced by commit "UBUNTU: SAUCE: acpi battery --
move first lookup asynchronous"), which partially reverted upstream
commit 0f66af5 ("ACPI: battery: asynchronous init").

Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
 drivers/acpi/battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 734b737..34e3d8f 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1169,7 +1169,7 @@ static struct acpi_driver acpi_battery_driver = {
 static int __init acpi_battery_init(void)
 	if (acpi_disabled)
-		return;
+		return -ENODEV;
 	acpi_battery_dir = acpi_lock_battery_dir();
 	if (!acpi_battery_dir)

More information about the kernel-team mailing list