From patchwork Mon Feb 20 16:15:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 9583223 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 30F66604A0 for ; Mon, 20 Feb 2017 16:16:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46B97283F2 for ; Mon, 20 Feb 2017 16:16:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AA4D2846C; Mon, 20 Feb 2017 16:16:15 +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 CBD30283F2 for ; Mon, 20 Feb 2017 16:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753473AbdBTQQN (ORCPT ); Mon, 20 Feb 2017 11:16:13 -0500 Received: from mga06.intel.com ([134.134.136.31]:10314 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751140AbdBTQQM (ORCPT ); Mon, 20 Feb 2017 11:16:12 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP; 20 Feb 2017 08:16:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,187,1484035200"; d="scan'208";a="826433825" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 20 Feb 2017 08:15:50 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id EAE474B1; 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 4/4] Input: soc_button_array - Propagate error from gpiod_count() Date: Mon, 20 Feb 2017 18:15:49 +0200 Message-Id: <20170220161549.39490-5-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 Acked-by: Dmitry Torokhov --- drivers/input/misc/soc_button_array.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index ddb2f22fca7a..c3b8e1fb4699 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -169,9 +169,10 @@ static int soc_button_probe(struct platform_device *pdev) button_info = (struct soc_button_info *)id->driver_data; - 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);