Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4941314pxb; Tue, 28 Sep 2021 07:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxtcV4867Q2gnRRbhxncfqkBwbUo5+tDceYVHvGobcFBp0c5zihmJsOjKHVK9l7xp0AHel X-Received: by 2002:a17:90a:708e:: with SMTP id g14mr250073pjk.214.1632838924350; Tue, 28 Sep 2021 07:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632838924; cv=none; d=google.com; s=arc-20160816; b=Ikt7z8vS+BvQQCXaLYOxp7WRaJYOLRS8jxYJWj2Wuo1JmxWoVoOgyxjo8RJtkoL9T7 7tplF0Eq+1w8islRNLchSALlL2KEMvLUUrQVVE7mXVSvv80aDr49lHdPoqP3vGdxNoyN +SBJh6ymwa1NA+pqkB5LXq9Y7PH8wvKwUF8DXhsFZKRGBaUdL9fC2TSjPhJSLE+WdMR7 aHs82+xEeGXTHOz+P0iEvq/fT6HyWBtKnNVkdM48aUiBZ/L+Rj8hW/OD/Vj+5ZU3xElo 4kuMkjfFzNqKRp1nIV9YIUJSeplUTGbyqk33SQuU4seputKDBjB7FQ0AMXnWxE84ByC2 MxWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ttto8ehYbbbZ6LfXTE9km8ZGwRBbXxJOc+0tTxPFkQo=; b=sY7JImb4xIBUpybcl3FjLAE7ZGwg4s4EKxamnZXiuG8ea56ZVvyWfZ32otNXCjlm48 yDEAjqH+YTOrwAHC6sSsL/ys9LivQ6AeXqFyeE5+yx9CfX9KemSnSHtomp+3a4vuV7CP 5UwOlw5JMMZW/CLH2kjbU22GOC5h+BtUiubU9nnQDfLueNv9hydwwEeM6NXGUq4X9igA Dp0SF1d9IYKuCR6rKpNswrnH81FN/mZBsbuilUPmAyUkbeQswcYXiVBAkKwOiW3bgdOv fEUQ1T5REEYaM+Ptdkm+KeK/lPP/vEiqy6yr4tfXINfCNdiadGGMyhRT9dNhOu+I6qwa LlzA== 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 g123si18087063pfb.111.2021.09.28.07.21.49; Tue, 28 Sep 2021 07:22:04 -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 S241249AbhI1OWN (ORCPT + 99 others); Tue, 28 Sep 2021 10:22:13 -0400 Received: from mx24.baidu.com ([111.206.215.185]:49142 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241244AbhI1OWM (ORCPT ); Tue, 28 Sep 2021 10:22:12 -0400 Received: from BJHW-Mail-Ex13.internal.baidu.com (unknown [10.127.64.36]) by Forcepoint Email with ESMTPS id 63ADA635ED54FF3630B8; Tue, 28 Sep 2021 22:20:31 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex13.internal.baidu.com (10.127.64.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Tue, 28 Sep 2021 22:20:31 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Tue, 28 Sep 2021 22:20:29 +0800 From: Cai Huoqing To: CC: Linus Walleij , Jonathan Cameron , 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 , , , , , , Subject: [PATCH v3 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 22:19:52 +0800 Message-ID: <20210928141956.2148-6-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210928141956.2148-1-caihuoqing@baidu.com> References: <20210928141956.2148-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BJHW-Mail-Ex13.internal.baidu.com (10.127.64.36) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) X-Baidu-BdMsfe-DateCheck: 1_BJHW-Mail-Ex13_2021-09-28 22:20:31:410 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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..014a77f98b98 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: */ @@ -1265,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; -- 2.25.1