Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3752945pxb; Mon, 27 Sep 2021 01:33:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9J8bRGcZm8r8EtuguNNjcpCxrUzmZcBPJvqamzdOcL1bE0h3rZ7BJZ3FWJxMCWKX0y35O X-Received: by 2002:a50:dacf:: with SMTP id s15mr22055785edj.385.1632731616078; Mon, 27 Sep 2021 01:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731616; cv=none; d=google.com; s=arc-20160816; b=zPhEwtjDahS+dePEP+Kr6mUflOU9clOb/HKe4wBnCamLKrkY/IU9zVfv/Lf0iowYfd QlBVSWI1UXifk5FTsy8CyIAW4Tj71OROIqaLuRDSS44RQrzeMDDqdhMrdTYosZff4FJE Cr9g+AT0lVTRjACrsCRgzLuQ31aC3wGLZbzloK4olOjPrvrPoQhqPKSrLt0317h71HY6 rV2q8WPKpuXdqzR+YXkNCHOc8675PDkg32XG2vyEArnlrWLEftKJaE0KMne/wGYHK2AF 5WRVYdrm9aVyQyEHYelMQWsMpeZVYw2NpDwgHqwcSqM+FUEJsvGHwp1wTjb/x3mTAEzJ 0QKg== 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=MjE7/Lsa7J4xm2OSYezuB62W1fu80mHuwMJWHVqzwnU=; b=H7BuSpdIoF85jLD/wRPobgRJgcNVGECd2A47B2ibMDowPadoedBWKdqqUgZabZo4zm uu4DtISphpNc22t1lNT/IVuG0KiLNw/+NBQ2PzY+2qR4iBIEkOV/KwNQn3PnkVUBP82c gcl1Q4+G0q/AeYm0IJzVoEB7sU72R5nqUp9EQbT94mgysHcctnNr9NPWSH1XviSnisdu jCz5DfjCm7l417K3LddhZGqVtM6nv83j3pKni6nePy9qRpF3qSfhNRkARhY1lXIxPSa1 CuH9dtLMiVERaqu7CFeC3YjuicjxrYXxQHbhKcAC/RJV/VPneq9LJMDhAsCOwvZdqI08 kYJg== 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 b21si18290011ejl.336.2021.09.27.01.33.11; Mon, 27 Sep 2021 01:33:36 -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 S233449AbhI0IdC (ORCPT + 99 others); Mon, 27 Sep 2021 04:33:02 -0400 Received: from mx22.baidu.com ([220.181.50.185]:38156 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233337AbhI0IdB (ORCPT ); Mon, 27 Sep 2021 04:33:01 -0400 Received: from BC-Mail-Ex03.internal.baidu.com (unknown [172.31.51.43]) by Forcepoint Email with ESMTPS id F1FA295BAE256D84D0D6; Mon, 27 Sep 2021 16:14:44 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex03.internal.baidu.com (172.31.51.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:14:44 +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; Mon, 27 Sep 2021 16:14:43 +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 3/9] iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:14:19 +0800 Message-ID: <20210927081426.762-3-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927081426.762-1-caihuoqing@baidu.com> References: <20210927081426.762-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex10.internal.baidu.com (172.31.51.50) 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 --- drivers/iio/adc/lpc18xx_adc.c | 16 ++++++++-------- 1 file changed, 8 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,19 @@ 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