Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2135438ybv; Sun, 23 Feb 2020 23:32:07 -0800 (PST) X-Google-Smtp-Source: APXvYqxR8nUo7YAAwnOBGEXmptFmOhFEYMXxLNHeMiEOCpWZGHUCoxc/WVmXpWji7UCrhh/+p16x X-Received: by 2002:a9d:2028:: with SMTP id n37mr40756278ota.127.1582529527350; Sun, 23 Feb 2020 23:32:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582529527; cv=none; d=google.com; s=arc-20160816; b=UKFKmvx9ABXYrLYmLwI11qQlqjMDKqwn/P+QdxVkpKlPb7wpzOS6qSb1hh8fHtUw02 YfoGgSyVuAqksWoyMqFZ7xdiHmDGtpq4Lmxw64qzwblPUUO8ZZ3z9fYsIOJ7qTDE2Jne Q6oHjUw5Lh+jY+PZIwDxypaElyBJxMI6JjYFttxicPi4j4dVbwMeG8FreoBciBCy+NwY FaYBY5drWai3ooHj91JmjXf+HHw0RK+WeYMminkdg2CPUhu7A6/5UUnvUIf8ljxX0J99 V3GJAO5J9kCBS1S5C3nxtrVZ9G8DOabwdtgkEFmcZ+jrx+OkX5Ka/PIFlV+bqISAqB1a U6/Q== 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=qtuBkOcY0Dk9ua18/wb+Os19J1ck7EfuOV1asjWw1cQ=; b=IDwArZH06KQFBz3TQtvtBrL1XTicf+YB7HetXYl4zULkdYEBiIHygXA9jdOW8IOs6Z whnl+yiL4oI0iSad61yRvSaSFsGpIJHpj8CRIZiwjkZ9KhJ8ER+PFO9OYU0ZD9VsqPC/ ROzwMrjMZtgI3WoH02IkhLC3kfuzbk6tCCU2n1U+LcI1aRbEe3fKgkbMxE78dzI2x4zQ 90bgiJ+bZhiOdJV+maaaxXopjn+soLT6e1iM6gjszWIrv5tAazA8bxyNNf171BvCbPL8 1nawkQ6cjdRWfFY0NB4c5Eh6AlpVupBxcTciQjtMMXmkNXdMUWW86CYtEprSQgeO2FZW Qu+Q== 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 p186si4785834oih.172.2020.02.23.23.31.53; Sun, 23 Feb 2020 23:32:07 -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 S1727202AbgBXHbP (ORCPT + 99 others); Mon, 24 Feb 2020 02:31:15 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:52176 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbgBXHbO (ORCPT ); Mon, 24 Feb 2020 02:31:14 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990678AbgBXHbLbR4t8 (ORCPT + 1 other); Mon, 24 Feb 2020 08:31:11 +0100 Date: Mon, 24 Feb 2020 08:31:10 +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: <20200224073110.GA58786@lenoch> References: <20200218102140.GA193069@lenoch> <20200218104810.GA194120@lenoch> <34f3cd11-321b-9aab-31a7-a3fb03691980@samsung.com> <20200221074740.GA44103@lenoch> <1cf484d9-572c-ea19-49d6-cd4cf61c9965@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1cf484d9-572c-ea19-49d6-cd4cf61c9965@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 24, 2020 at 11:12:08AM +0900, Chanwoo Choi wrote: > On 2/21/20 4:47 PM, Ladislav Michl wrote: > > On Tue, Feb 18, 2020 at 08:09:16PM +0900, Chanwoo Choi wrote: > >> On 2/18/20 7:48 PM, Ladislav Michl wrote: > >>> On Tue, Feb 18, 2020 at 07:35:47PM +0900, Chanwoo Choi wrote: > >>>> On 2/18/20 7:21 PM, Ladislav Michl wrote: > >>>>> 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; > >>> > >>> Here we returned... > >> > >> hmm. you better to suggest the result of cocci script > >> to understand why it is matter. > > > > You can browse similar fixes online :) > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=else+after+return > > > > As you commented, please share the result > of cocci or checkpatch warning. It is simple to finish > this discussion. What is happening here? Do we really need tools to see the obvious? See for example commit 09971adc33b ("staging: iio: addac: Remove unnecessary else after return"). Running script mentioned in above commit with "[PATCH v3] extcon: palmas: hide error messages if gpio returns" applied gives: ~/src/linux$ spatch -sp_file s.cocci -in_place drivers/extcon/extcon-palmas.c init_defs_builtins: /usr/lib/coccinelle/standard.h HANDLING: drivers/extcon/extcon-palmas.c diff = --- drivers/extcon/extcon-palmas.c +++ /tmp/cocci-output-67907-55371b-extcon-palmas.c @@ -207,7 +207,7 @@ static int palmas_usb_probe(struct platf GPIOD_IN); if (PTR_ERR(palmas_usb->id_gpiod) == -EPROBE_DEFER) { return -EPROBE_DEFER; - } else if (IS_ERR(palmas_usb->id_gpiod)) { + } if (IS_ERR(palmas_usb->id_gpiod)) { dev_err(&pdev->dev, "failed to get id gpio\n"); return PTR_ERR(palmas_usb->id_gpiod); } @@ -216,7 +216,7 @@ static int palmas_usb_probe(struct platf GPIOD_IN); if (PTR_ERR(palmas_usb->vbus_gpiod) == -EPROBE_DEFER) { return -EPROBE_DEFER; - } else if (IS_ERR(palmas_usb->vbus_gpiod)) { + } if (IS_ERR(palmas_usb->vbus_gpiod)) { dev_err(&pdev->dev, "failed to get vbus gpio\n"); return PTR_ERR(palmas_usb->vbus_gpiod); } That's why I wrote previously: "Then it is matter of time it triggers someones cocci script pointing to else after return." Linux git history proves there are people running such a scripts and results of such a scripts gets applied. I do not care too much, you are the one adding more work for yourself ;-) ladis