From patchwork Tue Jul 12 08:03:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 967502 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6C8CMMX015567 for ; Tue, 12 Jul 2011 08:12:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751526Ab1GLIEA (ORCPT ); Tue, 12 Jul 2011 04:04:00 -0400 Received: from mtagate6.uk.ibm.com ([194.196.100.166]:48011 "EHLO mtagate6.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751462Ab1GLIDy (ORCPT ); Tue, 12 Jul 2011 04:03:54 -0400 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate6.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p6C83ciS028530; Tue, 12 Jul 2011 08:03:38 GMT Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6C83crS1597594; Tue, 12 Jul 2011 09:03:38 +0100 Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6C83bg3023781; Tue, 12 Jul 2011 09:03:37 +0100 Received: from stefanha-thinkpad.manchester-maybrook.uk.ibm.com (dyn-9-174-219-30.manchester-maybrook.uk.ibm.com [9.174.219.30]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p6C83ZAj023704; Tue, 12 Jul 2011 09:03:36 +0100 From: Stefan Hajnoczi To: Len Brown , Anton Vorontsov , David Woodhouse Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Hajnoczi Subject: [PATCH 3/3] ACPI / Battery: propagate sysfs error in acpi_battery_add() Date: Tue, 12 Jul 2011 09:03:29 +0100 Message-Id: <1310457809-2731-4-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1310457809-2731-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1310457809-2731-1-git-send-email-stefanha@linux.vnet.ibm.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 12 Jul 2011 08:12:24 +0000 (UTC) Make sure the error return from sysfs_add_battery() is checked and propagated out from acpi_battery_add(). Signed-off-by: Stefan Hajnoczi --- drivers/acpi/battery.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 6b3aeba..2ae2fca 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -626,8 +626,11 @@ static int acpi_battery_update(struct acpi_battery *battery) acpi_battery_quirks(battery); acpi_battery_init_alarm(battery); } - if (!battery->bat.dev) - sysfs_add_battery(battery); + if (!battery->bat.dev) { + result = sysfs_add_battery(battery); + if (result) + return result; + } result = acpi_battery_get_state(battery); acpi_battery_quirks2(battery); return result; @@ -975,7 +978,9 @@ static int acpi_battery_add(struct acpi_device *device) if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, "_BIX", &handle))) set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); - acpi_battery_update(battery); + result = acpi_battery_update(battery); + if (result) + goto fail; #ifdef CONFIG_ACPI_PROCFS_POWER result = acpi_battery_add_fs(device); #endif