Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5632580rwp; Mon, 17 Jul 2023 07:15:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlHfVTeR6VTtmkLjfcHC0zh0GvEnr4yHLrqzhDBdK2FSOrChHfnFoIncTBUtjZ4vCCet3fif X-Received: by 2002:a05:6830:4c5:b0:6b9:b1a7:1f92 with SMTP id s5-20020a05683004c500b006b9b1a71f92mr11882994otd.8.1689603313360; Mon, 17 Jul 2023 07:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689603313; cv=none; d=google.com; s=arc-20160816; b=LaUFVQMQYQ92yHC0fk/IxYttq7HtrdMzya+TEo1gIo1WSHu1TCl3Z/Ra54c9UAWA7A VEdKZH4wE0GkNLof7UpalO0e+S5FLiqCSBo5kYtYYvqipYZKzyE6DnKUr9+YtA6TKf7z xfbGqBu0edPghWQtBL+XmfYy3ecnvZK1y0L+3bGqHVg8BVh5ZwKE/xbstT+hphd0ccxZ U7E5NY2fyaVrKkriZ0m8bZs70DI/E2dFcuZ18ydDLJjgKARR5G0WA8CyRcZFbOrRMXfW 6P+t1pJwEqwXmNEEmKYbQ1KscdZC0whaJItoRjqjT1PwnsuNTsO+x0Axcb1A4CthBhiB eHHw== 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=OVlC9M+FT1kIsD95lUg+v3VM6NpdVXxtheHZS2pOxpI=; fh=mnLFs2T4d3Z6eb/zB3HiZSO10pXuX4obYg8Xn0EL8EY=; b=KPS48cvE8c/Co75nWwG7jOAwvEpafnUt+hxOU1CT7rU7MGkBVffA2OXnL7sc52xqQz dARl5Qu4K0n7ZLkSVz6y//45X84LSj7jawmijc/P4zGb3iTsg3xK+sRhjgflKSYqufiC F4pXh+5rwdFb/paaLmd2ExGuDCBqX6lpMJb43ZVG7pUgFN672osUVAnEs2c9JsEYWA8I TsQicwxJu6g6DHu7PoUFiJJ2emzxzNNSr1gaImjAuxJdb/3T5I4zzBMCJjpT/g1iGD1D QzhvLfWbG+XbRK4d+plaXeDOnJRJ2OI6eRL6O5tZX0uxBdomRj8arsnchcTWoMHge8KX H5yA== 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 c6-20020a6566c6000000b0055798b90375si11893729pgw.709.2023.07.17.07.15.00; Mon, 17 Jul 2023 07:15:13 -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 S230500AbjGQN24 (ORCPT + 99 others); Mon, 17 Jul 2023 09:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231865AbjGQN16 (ORCPT ); Mon, 17 Jul 2023 09:27:58 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D11119AC for ; Mon, 17 Jul 2023 06:27:10 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:5803:2d6d:5bbc:e252]) by laurent.telenet-ops.be with bizsmtp id NDT62A00Z0ucMBo01DT6Sd; Mon, 17 Jul 2023 15:27:06 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qLOFd-001fw3-Ou; Mon, 17 Jul 2023 15:27:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qLOFm-007R1G-Lz; Mon, 17 Jul 2023 15:27:06 +0200 From: Geert Uytterhoeven To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH resend 2] Input: gpio-keys - convert to dev_err_probe() Date: Mon, 17 Jul 2023 15:27:05 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 20250b072a7a01c5..7e8342ef7a79b17f 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