Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbcDPACu (ORCPT ); Fri, 15 Apr 2016 20:02:50 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34153 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752397AbcDPACs (ORCPT ); Fri, 15 Apr 2016 20:02:48 -0400 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= To: corentin.chary@gmail.com, dvhart@infradead.org Cc: acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Subject: [PATCH v2 2/2] asus-laptop: correct error handling in sysfs_acpi_set Date: Sat, 16 Apr 2016 03:01:57 +0300 Message-Id: <1460764917-1042-2-git-send-email-giedrius.statkevicius@gmail.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1460764917-1042-1-git-send-email-giedrius.statkevicius@gmail.com> References: <1460764917-1042-1-git-send-email-giedrius.statkevicius@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 825 Lines: 28 Properly return rv back to the caller in the case of an error in parse_arg. In the process remove a unused variable 'out'. Signed-off-by: Giedrius Statkevičius --- drivers/platform/x86/asus-laptop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index d86d42e..9a69734 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c @@ -946,11 +946,10 @@ static ssize_t sysfs_acpi_set(struct asus_laptop *asus, const char *method) { int rv, value; - int out = 0; rv = parse_arg(buf, count, &value); - if (rv > 0) - out = value ? 1 : 0; + if (rv <= 0) + return rv; if (write_acpi_int(asus->handle, method, value)) return -ENODEV; -- 2.8.0