From patchwork Mon Mar 6 07:43:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9605203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D26606046A for ; Mon, 6 Mar 2017 07:44:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDFEB205FC for ; Mon, 6 Mar 2017 07:44:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2AFE2684F; Mon, 6 Mar 2017 07:44:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60F28205FC for ; Mon, 6 Mar 2017 07:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbdCFHoZ (ORCPT ); Mon, 6 Mar 2017 02:44:25 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:33802 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752610AbdCFHoY (ORCPT ); Mon, 6 Mar 2017 02:44:24 -0500 Received: by mail-io0-f193.google.com with SMTP id n76so17503451ioe.1; Sun, 05 Mar 2017 23:43:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=yYAxUG9EHdbNddqoTitCQVbL3aAVisLpTWgjkaNsE+k=; b=LUFJWW6dufAogzAbGfkUZruT25Iyps1TvuZcpo8FPrqh5j1rqo7zgdl/jQvvqSlkkj OeIHqbitCDyiPWFySeCSoOpV/OUya4PYLQsJ2bLPxXUTCIW+3AIcuo3tzszQ0dz5xgvr ODsuEdBEvqsamort0BEaaJv7JLHpgQdNi2zYxXyh67+mO9M6mB8UL/b3ORV4YjvNpxYN 2TpTt8emFFcSa2ZJrKbcvg8vkbCvHc+IMjkHwdVhtFDgoE944SopkUn3Zo6NmOpyf2Sx RdqRri5GaU330hnFS7OZgNd9roOSCoYyYGyinINWJKJDpwbF/oheSKmsCSVn8ARyQf19 dQsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yYAxUG9EHdbNddqoTitCQVbL3aAVisLpTWgjkaNsE+k=; b=EU3WvjsDquqfaQCMTgHrS+zdVjnoGqvST9r9x6cAHvh4IQEaHFONk/eoFnMYLivqAc DW2ICQIFsjsYHCxDRVpbSn1DtFSVZAMO1HoaqdBpvWPMxd3Lh3bdMOadF04wIJhLmegj qhgqq3rWpp65xtaw14lFkXI6qrvk+o3FDrFdtrN/hEJR1rVusX9y9l6YERLZgT7SOxET yNWWnNOBgZ1p+673mwYSjcA/h8dS/Hkt1l02TQKrMyH9/NQvWmn9wC1gSlbwUegD1fsA vxlYbbfYC8AVf7cvYFTBytSpY7rUe/zBdKBd16s05GtYDdNZFjnKD0uO/MCMfLGdi0fQ 3v8Q== X-Gm-Message-State: AMke39kY9wiCuwkDjWQqbnrKB3IavwYrDszcur9ZcyBfsGp86ZWsKbnxsLXVK0uAIlqE2Q== X-Received: by 10.107.134.94 with SMTP id i91mr12959900iod.0.1488786221644; Sun, 05 Mar 2017 23:43:41 -0800 (PST) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id c199sm8244817ioc.6.2017.03.05.23.43.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Mar 2017 23:43:41 -0800 (PST) From: Arvind Yadav To: ibm-acpi@hmh.eng.b, dvhart@infradead.org, andy@infradead.org Cc: ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x86: thinkpad_acpi: Handle return error. Date: Mon, 6 Mar 2017 13:13:26 +0530 Message-Id: <1488786206-20190-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is for handling a return error. Signed-off-by: Arvind Yadav --- drivers/platform/x86/thinkpad_acpi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 1d18b32..19ad3ec 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -1237,9 +1237,11 @@ static int tpacpi_rfk_hook_set_block(void *data, bool blocked) /* try to set radio state */ res = (tp_rfk->ops->set_status)(blocked ? TPACPI_RFK_RADIO_OFF : TPACPI_RFK_RADIO_ON); + if (res < 0) + return res; /* and update the rfkill core with whatever the FW really did */ - tpacpi_rfk_update_swstate(tp_rfk); + res = tpacpi_rfk_update_swstate(tp_rfk); return (res < 0) ? res : 0; } @@ -1371,7 +1373,10 @@ static ssize_t tpacpi_rfk_sysfs_enable_store(const enum tpacpi_rfk_id id, res = tpacpi_rfkill_switches[id]->ops->set_status((!!t) ? TPACPI_RFK_RADIO_ON : TPACPI_RFK_RADIO_OFF); - tpacpi_rfk_update_swstate(tpacpi_rfkill_switches[id]); + if (res < 0) + return res; + + res = tpacpi_rfk_update_swstate(tpacpi_rfkill_switches[id]); return (res < 0) ? res : count; } @@ -1427,7 +1432,9 @@ static int tpacpi_rfk_procfs_write(const enum tpacpi_rfk_id id, char *buf) "enable" : "disable", tpacpi_rfkill_names[id]); res = (tpacpi_rfkill_switches[id]->ops->set_status)(status); - tpacpi_rfk_update_swstate(tpacpi_rfkill_switches[id]); + if (res < 0) + return res; + res = tpacpi_rfk_update_swstate(tpacpi_rfkill_switches[id]); } return res; @@ -3517,6 +3524,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) if (tp_features.hotkey_wlsw) res = add_to_attr_set(hotkey_dev_attributes, &dev_attr_hotkey_radio_sw.attr); + if (res) + goto err_exit; res = hotkey_init_tablet_mode(); if (res < 0)