Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4471836pxb; Mon, 27 Sep 2021 18:38:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPmVoc6JMVFFROMdRp/sxY5InyN50CIdVQukItNvxc3bsEK5J9oiKdHOlQtt1XFqY7SLEF X-Received: by 2002:a05:6a00:1481:b0:43d:275b:7ba4 with SMTP id v1-20020a056a00148100b0043d275b7ba4mr2998531pfu.63.1632793101140; Mon, 27 Sep 2021 18:38:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793101; cv=none; d=google.com; s=arc-20160816; b=psE1dzxHJfn/Joy246tSXPfuuILnrraq+8jm66Q+L9yZA1SbzDj3asO8i3teGeBz3V qP6arNs9nr6QxGs2LBGkCs+CZ0/yPAHQ/j3avvUBnoFrQU2yXhyBYB0sB5uPzgGwMZ/8 aB4EvhsXA+MKX8AkpV5U6OSCGDJtc3+C828rY7gmZOviM54M9//gp+tBExK+bsH6YdQ1 /ltALc3x5j6zOlQ/udF4c1oCCapMMNBiMmIVT5oWoT/3C03ZiEqBDp5iNqQDqTfDCHkq yqN/03ezcrvsra7yCyeXygO0oHIYr/2igIATVASsUtDSucyfPCiXCOvFDpz5wvkqy5VZ IdNw== 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=Xs6vOLrB/OEKOKqwRQF4xS2HLHGmInRG0ZEDEIdxKjMpwAz1KWnT+lo0iKg/evgNW5 xzY27IE7k0PDoKlb+rFLCWw5imQuuJcOnm71tM332WCHFOSg2bcLqbMVLEW/mzKbTql3 6CGoHANIFTyHgA1zqYxcrtHJ9zbpevI4aSEz6ZPpoatrpd3/nMWwjDHkXW/tWiexKts4 38gKtaGobATVi+/o6d6cPX2brv2gVc0nq2leK40g7Yvonh9LKajSTpjc6ezX/f2SJqV5 T/58D4Uyn0UObBbBdDl/fxCrEREYq20qZJn27CuMELyW6CRRBmACgcPAlbxtyfRXUnC7 39yw== 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 u13si1382927pju.46.2021.09.27.18.38.08; Mon, 27 Sep 2021 18:38:21 -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 S238515AbhI1Bif (ORCPT + 99 others); Mon, 27 Sep 2021 21:38:35 -0400 Received: from mx24.baidu.com ([111.206.215.185]:45334 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238530AbhI1Bie (ORCPT ); Mon, 27 Sep 2021 21:38:34 -0400 Received: from BC-Mail-Ex15.internal.baidu.com (unknown [172.31.51.55]) by Forcepoint Email with ESMTPS id C39ECBD897605B769241; Tue, 28 Sep 2021 09:36:53 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex15.internal.baidu.com (172.31.51.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Tue, 28 Sep 2021 09:36:53 +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 09:36:52 +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 v2 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:36:17 +0800 Message-ID: <20210928013621.1245-6-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210928013621.1245-1-caihuoqing@baidu.com> References: <20210928013621.1245-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex24.internal.baidu.com (172.31.51.18) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) 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