From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3241CC433E2 for ; Thu, 10 Sep 2020 08:15:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA0E520732 for ; Thu, 10 Sep 2020 08:15:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730193AbgIJIPo (ORCPT ); Thu, 10 Sep 2020 04:15:44 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2802 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726961AbgIJINp (ORCPT ); Thu, 10 Sep 2020 04:13:45 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id CCFBE850CD2915818418; Thu, 10 Sep 2020 09:13:43 +0100 (IST) Received: from localhost (10.52.121.43) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Thu, 10 Sep 2020 09:13:43 +0100 Date: Thu, 10 Sep 2020 09:12:08 +0100 From: Jonathan Cameron To: Krzysztof Kozlowski CC: Andy Shevchenko , Lars-Peter Clausen , Tomasz Duszynski , "Michael Hennerich" , "linux-iio@vger.kernel.org" , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , Marek Vasut , "linux-samsung-soc@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Peter Meerwald-Stadler , "linux-amlogic@lists.infradead.org" , Peter Rosin , Jonathan Cameron Subject: Re: [PATCH v3 08/18] iio: adc: stm32: Simplify with dev_err_probe() Message-ID: <20200910091208.000055fa@Huawei.com> In-Reply-To: References: <20200829064726.26268-1-krzk@kernel.org> <20200829064726.26268-8-krzk@kernel.org> <20200909193600.41970d8c@archlinux> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.121.43] X-ClientProxiedBy: lhreml712-chm.china.huawei.com (10.201.108.63) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org On Thu, 10 Sep 2020 08:58:57 +0200 Krzysztof Kozlowski wrote: > On Thu, 10 Sep 2020 at 08:52, Andy Shevchenko wrote: > > > > > > > > On Thursday, September 10, 2020, Peter Rosin wrote: > >> > >> Hi! > >> > >> On 2020-09-09 21:57, Krzysztof Kozlowski wrote: > >> > On Wed, 9 Sep 2020 at 20:36, Jonathan Cameron wrote: > >> >> > >> >> On Sat, 29 Aug 2020 08:47:16 +0200 > >> >> Krzysztof Kozlowski wrote: > >> >> > >> >>> Common pattern of handling deferred probe can be simplified with > >> >>> dev_err_probe(). Less code and also it prints the error value. > >> >>> > >> >>> Signed-off-by: Krzysztof Kozlowski > >> >>> Reviewed-by: Andy Shevchenko > >> >>> > >> >> I don't have the thread to hand, but this tripped a warning next > >> >> and the patch was dropped as a result. See below. oops. That is what I get for reading an email very quickly then looking at the code a few hours later. Still a problem here we need to fix unless I'm missing something. > >> > > >> > Thanks for letting me know. If you mean the warning caused by: > >> > https://lore.kernel.org/lkml/20200909073716.GA560912@kroah.com/ > >> > then the driver-core patch was dropped, not the iio one: > >> > https://lore.kernel.org/linux-next/20200909074130.GB561485@kroah.com/T/#t > >> > > >> > So we are good here :) > >> > >> No, we are definitely not good. See below. That means "See below", and > >> not "Please take a guess at what is being talking about". > > > > > > > >> > >> >>> @@ -596,12 +594,9 @@ static int stm32_adc_core_switches_probe(struct device *dev, > >> >>> priv->booster = devm_regulator_get_optional(dev, "booster"); > >> >>> if (IS_ERR(priv->booster)) { > >> >>> ret = PTR_ERR(priv->booster); > >> >>> - if (ret != -ENODEV) { > >> >>> - if (ret != -EPROBE_DEFER) > >> >>> - dev_err(dev, "can't get booster %d\n", > >> >>> - ret); > >> >>> - return ret; > >> >>> - } > >> >>> + if (ret != -ENODEV) > >> >>> + dev_err_probe(dev, ret, "can't get booster\n"); > >> >> > >> >> This tripped a warning and got the patch dropped because we no longer > >> >> return on error. > >> > >> As Jonathan already said, we no longer return in this hunk. I.e., you have > >> clobbered the error path. > > > > > > Exactly my point why I proposed _must_check in the first place. > > That was not exactly that point as you did not mention possible errors > but only "miss the opportunity to optimize". Optimization is different > things than a mistake. In this particular case we have introduced a bug. If the regulator returns an error other than -ENODEV we will carry on when really should error out. This includes deferred probe route in which it won't print a message but also won't actually defer. Jonathan > > Best regards, > Krzysztof > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel