Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4956952pxb; Tue, 28 Sep 2021 07:41:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoAXW36t0zoq4Ih23VtW5a/u8Bl/TjV1zYVADVNk8uYvc5HvOp4M/yLbuxPKWavf2Hx8dp X-Received: by 2002:a50:cf4d:: with SMTP id d13mr7988483edk.50.1632840068573; Tue, 28 Sep 2021 07:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632840068; cv=none; d=google.com; s=arc-20160816; b=bm5DfO49eTOcFrSJiDCGfosiwduEWsPUBRwuND1rr3/A/JiUC3bolZgg6ckjmrwPXz AH2PZYj63V2NSYG0kJFEs/5V8MScoA8+URp1Pr9sP5gwHhXa73ccgG1em2eID9O9mZjl Jf+7urrra1G3Yxp6e6uhg1tbqhNvngg4oyvLvxkbeyfuR8XnieBGnKK7EIps0FDFdkNU P6EZxhx9LkGCQeQbdCEc7Nn8di0nntK23cxHlv7ynA89vwC1FSW0EnPUnq0Kset7Rhgy LEffCW5beU6OgfbTdbsO3h84c69ozHS1Z92W9VywN91tVY0P4c0oG3/mpQW0kQtpP8hc iEjA== 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=NNvx+AW8ISlFx6z9PlIcIDIQLXDUyihJ7ivXmKvCs8s6pECgdWFgXMs4bKcyvN8FIW ySxMTzcnXC8F7xD2lpHJMuDCXSTSVYP3+mGU65BZJOpojKngEktgRUgMHF01nugBvmG2 9cBFsBCG33ioPMxqcB/xU8NXK26QsbdEiXCJyzg3CuHDeHzpm/MihbYe4L/Uu5AcVLAe 8haYDdN4WEAbqWfnPEpJBoub6iwqNzYGwArk63ckROnuDqTh6d1XwPumeSxxx7gLLOZP jwHUg0khft1JIWsPPTsEVZmd1p5n+WGD1jRMdOjXik0cxB0MIa9qT373PmR4OPOyP1j/ KsuA== 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 v5si2414844edc.409.2021.09.28.07.40.42; Tue, 28 Sep 2021 07:41:08 -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 S241290AbhI1OiU (ORCPT + 99 others); Tue, 28 Sep 2021 10:38:20 -0400 Received: from mx22.baidu.com ([220.181.50.185]:60638 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241152AbhI1OiM (ORCPT ); Tue, 28 Sep 2021 10:38:12 -0400 Received: from BJHW-Mail-Ex01.internal.baidu.com (unknown [10.127.64.11]) by Forcepoint Email with ESMTPS id 76BABABF5FD0DB62B957; Tue, 28 Sep 2021 22:20:17 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex01.internal.baidu.com (10.127.64.11) 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:17 +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:16 +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 3/9] iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 22:19:49 +0800 Message-ID: <20210928141956.2148-3-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) 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