Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5703231ybv; Tue, 18 Feb 2020 02:22:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzvwfPVsJYRj/UXkckOQ9JavZkT6h2BbXF+TtAMYM0d+TmUAYipX54AbAitho0mozF763iR X-Received: by 2002:a05:6830:1294:: with SMTP id z20mr14914859otp.60.1582021371152; Tue, 18 Feb 2020 02:22:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582021371; cv=none; d=google.com; s=arc-20160816; b=mX9F+iuz3jzgoRoR3rGtLbHkiwwhtEcDxJAzEFB+C975nHeiKhuVsMGxQo9Hgr8ULq 71ZIE9ettsh66WEtDzgv1CrJmutRvI670u3eBB/fGnR1WFAucC9pBOVDtpwowz7CWo9l XX9Gnl9wikTtJuAs4AWC32HkrBjLePuIu1qxWD22kLzCrZ+Sj5tJ+YFNfaROkwbsxwNG NtK4TwGn2mfOaqoK+7xy3Z9TTVrjcuUkvM1kme5lEtTXZkF76hdpxtQBn+AGAKrwgnBO 1ZPqT8OSABej1fdXrNf4yjBbaJDPaLfnXSTVc0j0nppfcFCmGxTfjOPnHLCTvaiyg70F Qj+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=bkZMYDddY/njGMZ/NC1lBvvExdakvwIuX2LIcD129tY=; b=qqJ7bzt/KNIz5Vd/+3pR8VlJABLDsnug103+YWKPP+eA4vVuS6uG37GdIOL+u0HE/9 DrAIk+MT3BYtf1zGx5y3bopzWAFVNplEIWWyH6NTi5Cc2Sb1H9NW/AThOErLAuZbSy7V 4h9Fm5E/hAymBypH0+2oi8DvVWMOuplsC3yuzL5hSqBHPLLk655qpW/o7f4wEPXSk8V7 gVN5j0zjHO3D/5GJvy4kUn5pfabN3nhSzcci39Rub5ozmyAr5HB5RGP6pObSLFPshQJE D52FhGenbobG3iH7DwiJ6T08+GuY6KZRkfTVSSWtO8EO6rgxtnkNAgucbt+YdJU0J5h7 nBfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18si1530144otf.231.2020.02.18.02.22.26; Tue, 18 Feb 2020 02:22:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726360AbgBRKVo (ORCPT + 99 others); Tue, 18 Feb 2020 05:21:44 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:46520 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726193AbgBRKVo (ORCPT ); Tue, 18 Feb 2020 05:21:44 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990398AbgBRKVlVM4bN (ORCPT + 1 other); Tue, 18 Feb 2020 11:21:41 +0100 Date: Tue, 18 Feb 2020 11:21:40 +0100 From: Ladislav Michl To: Chanwoo Choi Cc: "H. Nikolaus Schaller" , MyungJoo Ham , linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, kernel@pyra-handheld.com, linux-omap@vger.kernel.org Subject: Re: [PATCH v3] extcon: palmas: hide error messages if gpio returns -EPROBE_DEFER Message-ID: <20200218102140.GA193069@lenoch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 18, 2020 at 12:28:25PM +0900, Chanwoo Choi wrote: > On 2/17/20 10:38 PM, H. Nikolaus Schaller wrote: > > If the gpios are probed after this driver (e.g. if they > > come from an i2c expander) there is no need to print an > > error message. > > > > Signed-off-by: H. Nikolaus Schaller > > --- > > drivers/extcon/extcon-palmas.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c > > index edc5016f46f1..cea58d0cb457 100644 > > --- a/drivers/extcon/extcon-palmas.c > > +++ b/drivers/extcon/extcon-palmas.c > > @@ -205,14 +205,18 @@ static int palmas_usb_probe(struct platform_device *pdev) > > > > palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id", > > GPIOD_IN); > > - if (IS_ERR(palmas_usb->id_gpiod)) { > > + if (PTR_ERR(palmas_usb->id_gpiod) == -EPROBE_DEFER) { > > + return -EPROBE_DEFER; > > + } else if (IS_ERR(palmas_usb->id_gpiod)) { > > dev_err(&pdev->dev, "failed to get id gpio\n"); > > return PTR_ERR(palmas_usb->id_gpiod); > > } > > > > palmas_usb->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus", > > GPIOD_IN); > > - if (IS_ERR(palmas_usb->vbus_gpiod)) { > > + if (PTR_ERR(palmas_usb->vbus_gpiod) == -EPROBE_DEFER) { > > + return -EPROBE_DEFER; > > + } else if (IS_ERR(palmas_usb->vbus_gpiod)) { > > dev_err(&pdev->dev, "failed to get vbus gpio\n"); > > return PTR_ERR(palmas_usb->vbus_gpiod); > > } > > > > I think that it is enough to handle the -EPROBE_DEFER. > Also, I prefer to use single if/else statement > instead of the nested if/else statement. > > Applied it. Uh... As it is? Then it is matter of time it triggers someones cocci script pointing to else after return. Could you at least fix this? Thanks, ladis