From patchwork Sat Jul 16 22:58:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 982632 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6GMx0Zo025491 for ; Sat, 16 Jul 2011 22:59:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752001Ab1GPW7A (ORCPT ); Sat, 16 Jul 2011 18:59:00 -0400 Received: from vms173001pub.verizon.net ([206.46.173.1]:47091 "EHLO vms173001pub.verizon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520Ab1GPW67 (ORCPT ); Sat, 16 Jul 2011 18:58:59 -0400 Received: from localhost.localdomain ([unknown] [65.175.195.226]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LOG00HLW7U897K0@vms173001.mailsrvcs.net>; Sat, 16 Jul 2011 17:58:59 -0500 (CDT) Received: from localhost.localdomain (x980 [127.0.0.1]) by localhost.localdomain (8.14.4/8.14.4) with ESMTP id p6GMwt7U010086; Sat, 16 Jul 2011 18:58:55 -0400 Received: from localhost (lenb@localhost) by localhost.localdomain (8.14.4/8.14.4/Submit) with ESMTP id p6GMwttM010081; Sat, 16 Jul 2011 18:58:55 -0400 X-Authentication-warning: localhost.localdomain: lenb owned process doing -bs Date: Sat, 16 Jul 2011 18:58:55 -0400 (EDT) From: Len Brown X-X-Sender: lenb@x980 To: Stefan Hajnoczi Cc: Anton Vorontsov , David Woodhouse , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] ACPI / Battery: propagate sysfs error in acpi_battery_add() In-reply-to: <1310457809-2731-4-git-send-email-stefanha@linux.vnet.ibm.com> Message-id: References: <1310457809-2731-1-git-send-email-stefanha@linux.vnet.ibm.com> <1310457809-2731-4-git-send-email-stefanha@linux.vnet.ibm.com> User-Agent: Alpine 2.02 (LFD 1266 2009-07-14) MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII 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 (demeter1.kernel.org [140.211.167.41]); Sat, 16 Jul 2011 22:59:01 +0000 (UTC) applied, after merging with acpi-test. merged version appended below. thanks, Len Brown, Intel Open Source Technology Center From eb03cb02b74df6dd0b653d5f6d976f16a434dfaf Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 12 Jul 2011 09:03:29 +0100 Subject: [PATCH] ACPI / Battery: propagate sysfs error in acpi_battery_add() X-Patchwork-Hint: ignore Make sure the error return from sysfs_add_battery() is checked and propagated out from acpi_battery_add(). Signed-off-by: Stefan Hajnoczi Signed-off-by: Len Brown --- 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 c771768..ffce2f0 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -630,8 +630,11 @@ static int acpi_battery_update(struct acpi_battery *battery) return result; 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_quirks(battery); return result; @@ -982,7 +985,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