From patchwork Mon Feb 20 16:15:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 9583229 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 61699604A0 for ; Mon, 20 Feb 2017 16:16:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7821728449 for ; Mon, 20 Feb 2017 16:16:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CBD7284D5; Mon, 20 Feb 2017 16:16:44 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 E3A2C28449 for ; Mon, 20 Feb 2017 16:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753903AbdBTQQ0 (ORCPT ); Mon, 20 Feb 2017 11:16:26 -0500 Received: from mga06.intel.com ([134.134.136.31]:6754 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751341AbdBTQQY (ORCPT ); Mon, 20 Feb 2017 11:16:24 -0500 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 20 Feb 2017 08:16:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,187,1484035200"; d="scan'208";a="227559743" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 20 Feb 2017 08:16:20 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E32AF4A8; Mon, 20 Feb 2017 18:15:49 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , linux-gpio@vger.kernel.org, Dmitry Torokhov , linux-input@vger.kernel.org, Darren Hart , platform-driver-x86@vger.kernel.org, Benjamin Tissoires , linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 3/4] platform/x86: surface3_button: Propagate error from gpiod_count() Date: Mon, 20 Feb 2017 18:15:48 +0200 Message-Id: <20170220161549.39490-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170220161549.39490-1-andriy.shevchenko@linux.intel.com> References: <20170220161549.39490-1-andriy.shevchenko@linux.intel.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since gpiod_count() does not return 0 anymore, we don't need to shadow its error code and would safely propagate to the user. While here, replace second parameter by NULL in order to prevent side effects on _DSD enabled firmware. Cc: Benjamin Tissoires Signed-off-by: Andy Shevchenko --- drivers/platform/x86/surface3_button.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/surface3_button.c b/drivers/platform/x86/surface3_button.c index 8bfd7f613d36..57f51476bb65 100644 --- a/drivers/platform/x86/surface3_button.c +++ b/drivers/platform/x86/surface3_button.c @@ -196,9 +196,10 @@ static int surface3_button_probe(struct i2c_client *client, strlen(SURFACE_BUTTON_OBJ_NAME))) return -ENODEV; - if (gpiod_count(dev, KBUILD_MODNAME) <= 0) { + error = gpiod_count(dev, NULL); + if (error < 0) { dev_dbg(dev, "no GPIO attached, ignoring...\n"); - return -ENODEV; + return error; } priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);