Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4484128rwd; Tue, 23 May 2023 08:16:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ75nZB/7dDnTOphSop52Jd59p4g6VL9QxEhSLzkxnbe7DjTkNgTlzM2LuDUJ7d74kuyMDYs X-Received: by 2002:a05:6a21:9999:b0:10a:c09c:bd with SMTP id ve25-20020a056a21999900b0010ac09c00bdmr13110160pzb.55.1684855004174; Tue, 23 May 2023 08:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684855004; cv=none; d=google.com; s=arc-20160816; b=SUM2CDL4AaogWgxy6YoBYBptVpl+hFiD7z1voQzrYoOoxYIe+Z7wJxL/EBScejy36Q cSnPMBGVdBuD5QSnAveYyJfIq1vaSGWx/lH9RBYLzKoJv1kuyio+z/tEXTIq2nJGjd8n 85lQpQ/xQ+eGzmuTzpddLtO+uh6Hf2FYPFHGFVBRJA6WPmA+bD3+FkJ+Z9+4nDMNh1F4 AfOVfAodWQjcIvtz9ZF6uxKRHzK6KBNxq6zeLsUxuICJ+zNnPJ3kWEEhYjtit6wutp/8 /mhKiusROvsa2fhFD8mYOfd3CMXvSffEeU8e04azxtqMzcS2VrRcvnqf4q7IUok8T92N G6xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=S82svTrvxny4aDGyP/j17iOFvjY4L9G+4A7fL4DPgoM=; b=UrX0/noyS05oSJE9G8pwHNm9kJ7rSugsfBTfWK7ev/y4c9G5mZO1/riMO+fRW6Hxk7 FYFRaKqpNMxvEnlQrSdbTvchlou29EGsO+/YiqCs57CiTWZSUBk3kOnO96WFCJpy2Rte Q12WwQps6LGODUF50U0irgmz7SnmwI0Ro44QCoCGnPZs8boPyDh8DnJuv+g/MqSkhHAg PEWn5BuuSnMA52ESAkDciCr4qibbvJfFoU2IbzU8SO7fy2JjltcCZcCgCVnAQIRA7QvN lLLfeICfEHanFszPU8yjR5bRPckrXzJ1fbrHyirbuwBf1lzEsJYmr8BZtl2WmJcYj/It Lbxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s26-20020aa78bda000000b0064d26a10764si1723427pfd.266.2023.05.23.08.16.31; Tue, 23 May 2023 08:16:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237524AbjEWPNq (ORCPT + 99 others); Tue, 23 May 2023 11:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237533AbjEWPN3 (ORCPT ); Tue, 23 May 2023 11:13:29 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 466AEE7C for ; Tue, 23 May 2023 08:13:09 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed30:b0ac:7afd:272:4cff]) by albert.telenet-ops.be with bizsmtp id 0FD72A0010Jkz7G06FD7NG; Tue, 23 May 2023 17:13:07 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1q1Tgy-002swX-Dr; Tue, 23 May 2023 17:13:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1q1ThC-00CkPC-Rr; Tue, 23 May 2023 17:13:06 +0200 From: Geert Uytterhoeven To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH resend] Input: gpio-keys - convert to dev_err_probe() Date: Tue, 23 May 2023 17:13:05 +0200 Message-Id: <9fc16eea6fd2c687b69e007e792e8c6338f80e48.1684854670.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the dev_err_probe() helper, instead of open-coding the same operation. While at it, invert the error checking logic to simplify code flow. Signed-off-by: Geert Uytterhoeven --- drivers/input/keyboard/gpio_keys.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 93b75d78a9cb882f..5e18ef01b0340f1b 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -523,18 +523,15 @@ static int gpio_keys_setup_key(struct platform_device *pdev, NULL, GPIOD_IN, desc); if (IS_ERR(bdata->gpiod)) { error = PTR_ERR(bdata->gpiod); - if (error == -ENOENT) { - /* - * GPIO is optional, we may be dealing with - * purely interrupt-driven setup. - */ - bdata->gpiod = NULL; - } else { - if (error != -EPROBE_DEFER) - dev_err(dev, "failed to get gpio: %d\n", - error); - return error; - } + if (error != -ENOENT) + return dev_err_probe(dev, error, + "failed to get gpio\n"); + + /* + * GPIO is optional, we may be dealing with + * purely interrupt-driven setup. + */ + bdata->gpiod = NULL; } } else if (gpio_is_valid(button->gpio)) { /* -- 2.34.1