Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4471705pxb; Mon, 27 Sep 2021 18:38:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO6taBFs10br6NX4RKgOjoVfHBAp7JB64GtrPsyQKAAHCWYYJys5g+8mwIGaQhzkjjR3u4 X-Received: by 2002:a17:902:7d95:b0:13e:1272:884a with SMTP id a21-20020a1709027d9500b0013e1272884amr2679052plm.34.1632793090540; Mon, 27 Sep 2021 18:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793090; cv=none; d=google.com; s=arc-20160816; b=PCMknzf2I49iQa5482L6Fp1isyC+m+eaIme0HliTgA8gkieHxAJKZcTi6jDNOvE88r POEvZxa5VE36h9JChc5xb4FVv20Brm9t+klysXFnRygYygWy/I9e1nVYJ3gy4oqSmEad /gNt+Rm8sT04tfO45i9sXyBzSjWWIq6M+NgAENZRupOzqPs551yiGawToxPHiUti+lTh dopuIT2XsMdmmGlduoadK64t1marXBM4hrSiM6ZfDLQ0AjFT2PqyWw9Jdtn7XsHbG5Uc zm4IjetBAclSOkZuajpohwihBI2pZqt73Tkfi8XT2pB458Qi8rFffohdMY7WV4aM4j33 hzag== 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=NPhsJKzAJi/o2AcR643P4e77teICnqCTIv4wB/tHOWo=; b=vSeB6gBrkI1NOk5qtGWO9EM7248IIqQdduN5iYUi0vojs/zBN4oJCNp4ZjJIjHecCl +BtQHPnRHhMtL0elVahVkL1tIUe8sz95HGMeqCNQC3KRSDlyeFBjp1/9p10VjZmQ5a3j ZUWmacK7aUBtcKcLIHJvRpptrUG3iPlTNIlFZE/Z21OA/+V1geVJHfDFh7+Qi/rm2mGa 9Cto8EAEFCqxiAGHAAT5N5tU0ILA4DuwN2E9zdpzhZZ6A72IbyvguImPhh/K3YBOQLNv 55+CS4J/D026OwiCL92SfZLnTZE2C00ZMVNUiRejBFAdSIwEzUrbVE/nvhx+GsMJAbOd FL3A== 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 22si24698141pgs.373.2021.09.27.18.37.44; Mon, 27 Sep 2021 18:38:10 -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 S238501AbhI1BiZ (ORCPT + 99 others); Mon, 27 Sep 2021 21:38:25 -0400 Received: from mx24.baidu.com ([111.206.215.185]:44860 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238466AbhI1BiV (ORCPT ); Mon, 27 Sep 2021 21:38:21 -0400 Received: from BJHW-Mail-Ex15.internal.baidu.com (unknown [10.127.64.38]) by Forcepoint Email with ESMTPS id C04F86286140E4DF48BA; Tue, 28 Sep 2021 09:36:39 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex15.internal.baidu.com (10.127.64.38) 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:39 +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:38 +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 3/9] iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:36:14 +0800 Message-ID: <20210928013621.1245-3-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) X-Baidu-BdMsfe-DateCheck: 1_BJHW-Mail-Ex15_2021-09-28 09:36:39:773 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/lpc18xx_adc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/lpc18xx_adc.c b/drivers/iio/adc/lpc18xx_adc.c index 3566990ae87d..caa7feb4219f 100644 --- a/drivers/iio/adc/lpc18xx_adc.c +++ b/drivers/iio/adc/lpc18xx_adc.c @@ -137,19 +137,17 @@ static int lpc18xx_adc_probe(struct platform_device *pdev) return PTR_ERR(adc->base); adc->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(adc->clk)) { - dev_err(&pdev->dev, "error getting clock\n"); - return PTR_ERR(adc->clk); - } + if (IS_ERR(adc->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(adc->clk), + "error getting clock\n"); rate = clk_get_rate(adc->clk); clkdiv = DIV_ROUND_UP(rate, LPC18XX_ADC_CLK_TARGET); adc->vref = devm_regulator_get(&pdev->dev, "vref"); - if (IS_ERR(adc->vref)) { - dev_err(&pdev->dev, "error getting regulator\n"); - return PTR_ERR(adc->vref); - } + if (IS_ERR(adc->vref)) + return dev_err_probe(&pdev->dev, PTR_ERR(adc->vref), + "error getting regulator\n"); indio_dev->name = dev_name(&pdev->dev); indio_dev->info = &lpc18xx_adc_info; -- 2.25.1