Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp714418pxb; Sun, 10 Oct 2021 09:22:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwmZNKcTuj0Kf7SmLiTNXYFOqpxZ3sY5Aw9Vyiu01aufaI6rpvsMKcLakBe+hTyUP7iJ8r X-Received: by 2002:a17:906:63c1:: with SMTP id u1mr20196207ejk.436.1633882948497; Sun, 10 Oct 2021 09:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633882948; cv=none; d=google.com; s=arc-20160816; b=xQx7gtTKIRm50AKkyin1bHCqWIySMqBKqhlan6j39GklUNyUsNtKpokdxIOifg4vFX YbCBZ/1DQ8hjDdoQSiNmywx5PtynmukDF4mtPOADFjsfz5bSry+wIPFoNF5s7PNJ+PBu jdycxOuaNTSp9CKSmOrXueilrf1am3ezEyF42a30EccaZQaHk07sBohJXvK28TdJbJWk BgDrsa+i58fHaHMtDdF846QLkgOsCuSDt/9Rnp7Nx9YmNjyzEz2vNJFUE1yDHplihSdD 5XVilG5Gc5SKpwswMlKi6hCwWjoYXl9qxKM4fhhfVneiLUoD6Rx8+QwpmZVNPvZPe8qH 2n6g== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Cy5KneXtg7MYPx1XS4JjLg9Ivc9sKuCFR3A6R5HyUTc=; b=f6cfY/PXDkf4E/fAFv1v6oWYYGU/DRt5Gh26q3UMsgXsnv18yVTqnl0o8H/evnE9Ir gWTmxBNTI89serjl+aqY5yGvoTIMAMTU4Mzw3pvRRIvKWQS0v0tvU3x304BGQNnjViSJ 1sCS9HaYkcaDG2sgedDBfrOL9kBw/AkXOXDh++EbFzz7LfFlJHWuOXL67v2sgARVE2VQ ouAdcV3eOlxaQUsmYIjdN9LyzEEU5JTqWH/f0S4BUtVT7zn89vP/YcRjpC63cOVTXkdb 9lhVbX4iLvJqlUXJQ3222SL8WtG0oEh/yLCfHz0CjT+UQWWCB94KOh7sQJ6s3z1EYwAh VF1Q== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 25si7577783ejh.765.2021.10.10.09.22.05; Sun, 10 Oct 2021 09:22:28 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232793AbhJJQDb (ORCPT + 99 others); Sun, 10 Oct 2021 12:03:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:55146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232849AbhJJQD0 (ORCPT ); Sun, 10 Oct 2021 12:03:26 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6337460F5B; Sun, 10 Oct 2021 16:01:21 +0000 (UTC) Date: Sun, 10 Oct 2021 17:05:27 +0100 From: Jonathan Cameron To: Cai Huoqing Cc: Linus Walleij , Lars-Peter Clausen , Shawn Guo , Sascha Hauer , "Pengutronix Kernel Team" , Fabio Estevam , "NXP Linux Team" , Vladimir Zapolskiy , "Neil Armstrong" , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Andy Gross , "Bjorn Andersson" , Heiko Stuebner , Philipp Zabel , , , , , , Subject: Re: [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe() Message-ID: <20211010170527.13547811@jic23-huawei> In-Reply-To: <20211008092858.495-6-caihuoqing@baidu.com> References: <20211008092858.495-1-caihuoqing@baidu.com> <20211008092858.495-6-caihuoqing@baidu.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 Oct 2021 17:28:54 +0800 Cai Huoqing wrote: > When possible use dev_err_probe help to properly deal with the > PROBE_DEFER error, the benefit is that DEFER issue will be logged > in the devices_deferred debugfs file. > Using dev_err_probe() can reduce code size, and the error value > gets printed. > > Signed-off-by: Cai Huoqing Make sure you don't miss any tags on previous versions. This had: Reviewed-by: Martin Blumenstingl Tested-by: Martin Blumenstingl #Meson8b Odroid-C1 > v1->v2: Remove the separate line of PTR_ERR(). > > drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++------------------- > 1 file changed, 17 insertions(+), 22 deletions(-) > > diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c > index 705d5e11a54b..62cc6fb0ef85 100644 > --- a/drivers/iio/adc/meson_saradc.c > +++ b/drivers/iio/adc/meson_saradc.c > @@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev) > return ret; > > priv->clkin = devm_clk_get(&pdev->dev, "clkin"); > - if (IS_ERR(priv->clkin)) { > - dev_err(&pdev->dev, "failed to get clkin\n"); > - return PTR_ERR(priv->clkin); > - } > + if (IS_ERR(priv->clkin)) > + return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin), > + "failed to get clkin\n"); > > priv->core_clk = devm_clk_get(&pdev->dev, "core"); > - if (IS_ERR(priv->core_clk)) { > - dev_err(&pdev->dev, "failed to get core clk\n"); > - return PTR_ERR(priv->core_clk); > - } > + if (IS_ERR(priv->core_clk)) > + return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk), > + "failed to get core clk\n"); > > priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk"); > if (IS_ERR(priv->adc_clk)) { > - if (PTR_ERR(priv->adc_clk) == -ENOENT) { > + if (PTR_ERR(priv->adc_clk) == -ENOENT) > priv->adc_clk = NULL; > - } else { > - dev_err(&pdev->dev, "failed to get adc clk\n"); > - return PTR_ERR(priv->adc_clk); > - } > + else > + return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk), > + "failed to get adc clk\n"); > } > > priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel"); > if (IS_ERR(priv->adc_sel_clk)) { > - if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) { > + if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) > priv->adc_sel_clk = NULL; > - } else { > - dev_err(&pdev->dev, "failed to get adc_sel clk\n"); > - return PTR_ERR(priv->adc_sel_clk); > - } > + else > + return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk), > + "failed to get adc_sel clk\n"); > } > > /* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */ > @@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev) > } > > priv->vref = devm_regulator_get(&pdev->dev, "vref"); > - if (IS_ERR(priv->vref)) { > - dev_err(&pdev->dev, "failed to get vref regulator\n"); > - return PTR_ERR(priv->vref); > - } > + if (IS_ERR(priv->vref)) > + return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref), > + "failed to get vref regulator\n"); > > priv->calibscale = MILLION; >