Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1274691pxb; Fri, 24 Sep 2021 00:19:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzaKcmQM6iEgFSuR0FO70ygzqkx3hSlhqpfDtOhJyVQrbhY4vXxAcI7S++k9WAO9WpM1Sj X-Received: by 2002:a05:6402:42d4:: with SMTP id i20mr3405534edc.348.1632467945641; Fri, 24 Sep 2021 00:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632467945; cv=none; d=google.com; s=arc-20160816; b=yWMYM8krp09bK1xhCtkK3kgHOMEjHACKd+hxwBaLPrLbEtNBwCiJZI2S0CQRY1d6XQ IEElv2WKMJOmuh9ugAxjPwY40k1W7Ccp20pY0yCOzcjZ4S0GcjTaJB7QWQoF85n1sZvr aTscJu+lU9gHgdJ22znGtIsC0PAWB5riiKwn/3FGHCSfkzZuo4psXYIW1bEYnIainO1h KhAKjQxGOnIIb752Lzlnfd7lNwpndwXwx4jxdnLSJfdvhSXNmKK5LatjlZjXFhwUVy3E c+NjndiCz6LGCTVvButmFOPQzRGCkNs9BKkpaRgX2qtIAMGbgtfTHEPsuYuwEGorsVHn egPw== 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=dijFh/BTuFe+YZFejdczsrv4NtwK/hYiULqfvB73pGU=; b=e0JKW6aZ20gBCY0Q5uwnoxjYFSPOtaNidjX0k9ssee21GvjVf2ufiComsIhwEidOyq qhaFqV8hHrXhXnbw+4WrG2zya0xBpEoCf9TudvJllLuyieyZr8C9bFT5Rh1cNKQEpDNm fc4Sh1pTkRMMkrozjPUeeZgxQMGvK5y5BB3lA/LWcqd3FV1I7aAdIfxTdp97K1IhCoCm M9b4ytmk0NZ8yT3Iymsg2zZK1oztVMALAMXOh//jWVtDyalLhz2ao8EpSiXldeODqMOx +JYSsAubKCoTYOwyXLrIQgbaEJUjuMgisH4NP+/kAgWrp8OwD3K53PA/aXAU4r0wxozW csGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m15si8467077edp.413.2021.09.24.00.18.41; Fri, 24 Sep 2021 00:19:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244332AbhIXHSz (ORCPT + 99 others); Fri, 24 Sep 2021 03:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244321AbhIXHSr (ORCPT ); Fri, 24 Sep 2021 03:18:47 -0400 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0B15C061574 for ; Fri, 24 Sep 2021 00:17:14 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed10:5dd8:9bc4:3752:5710]) by michel.telenet-ops.be with bizsmtp id xjHD2500C2gynNa06jHD1y; Fri, 24 Sep 2021 09:17:13 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mTfSL-008VhM-0i; Fri, 24 Sep 2021 09:17:13 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1mTfSK-007LTR-Hf; Fri, 24 Sep 2021 09:17:12 +0200 From: Geert Uytterhoeven To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] Input: gpio-keys - convert to dev_err_probe() Date: Fri, 24 Sep 2021 09:17:11 +0200 Message-Id: <5cc045d789a71f5c2896b7c11eb79ea75a9fabf8.1632467778.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 8dbf1e69c90ac92f..0f2250c6aa4978d5 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.25.1