Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752856AbdCFIye (ORCPT ); Mon, 6 Mar 2017 03:54:34 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:33815 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbdCFIy0 (ORCPT ); Mon, 6 Mar 2017 03:54:26 -0500 MIME-Version: 1.0 In-Reply-To: <1488786206-20190-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1488786206-20190-1-git-send-email-arvind.yadav.cs@gmail.com> From: Andy Shevchenko Date: Mon, 6 Mar 2017 10:45:50 +0200 Message-ID: Subject: Re: [PATCH] x86: thinkpad_acpi: Handle return error. To: Arvind Yadav Cc: Henrique de Moraes Holschuh , "dvhart@infradead.org" , Andy Shevchenko , ibm-acpi-devel@lists.sourceforge.net, Platform Driver , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1743 Lines: 51 On Mon, Mar 6, 2017 at 9:43 AM, Arvind Yadav wrote: > 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); Just in case: first parens are redundant here. > + if (res < 0) > + return res; So, this changes behaviour. Before we call _rfk_update_swstate() independently on error code. Care to explain in commit message how this change does / does not affect overall user experience? > /* 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; > } > @@ -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) Ditto for hotkey_init_tablet_mode(). -- With Best Regards, Andy Shevchenko