Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2177610pxb; Fri, 8 Oct 2021 02:30:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE6pf283+nypJ8SUaIPAsXJftsF6xdJdhyQonGZ47NONvytBRP437fCI3idWpPVyV94f1d X-Received: by 2002:a17:90a:8c82:: with SMTP id b2mr11219402pjo.173.1633685422217; Fri, 08 Oct 2021 02:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633685422; cv=none; d=google.com; s=arc-20160816; b=fKRwwCCec+uEdVV4dmWK2kUzzX8JHse3wTH9in7SzZqx/1K5kcxVI8YqsUzGKgFI8W X6rcbms7aJOOcabEbnuW+iG+GeabxlAvSIOBsHTiLGMWhKjBHlAQSC0CofWNdSo8Qr3W +T82fLuStl0TvsKNpqf418arNlqWnvvZDkIBqAIRGorNAu7lHep5PT2gNyaJPU1B2IUp v/aiqgDbKdx5utv9fWq+yu9A8v8IutFvlCTbY4NkR68Xct7sOqt99GiAwA+oGh+18Fw9 JZ6JJTnmaSdGaAkn2eWpnl30q0Gj3xc7rsUuiqaSNg6beqihkkCGospx59VtXNns037P gTOA== 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=j9jzlfiTFIKRifBEuTpqCVE6QaRrXkHMfZFI2u/0rqA=; b=GQKNJoBynBVaDrtzvLbhiaABeB8a0gKxrudOiqk7+b563I5dOZkFZH32JqLLfD91Jz IF5n2PxiSb8V1pcqYepPdfy/2n2I5imd7pq3ZZjGsgh8B66PPB2pF6viXFYHGh8cu0l8 WluK/yMqA0ZaBTGYsx+pgFr4Bspv8YEnwv1w2WkIf/uUZP8MGJoLO4OL7wryhb4TAJ9G b1PfAkvHMS9fisimXvJVkLNXGsr7jOwY5rmECjD3RlCHqSGKnNow4EmHMy8ztk1SAMyH A1hjZaYq5rELGNtUxGntwTyT7aHe8Q9AhHHCfxO4faJiuIq9AZWAX2Nia7lXoe9fK65C He8Q== 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 a17si2529047pjo.89.2021.10.08.02.30.08; Fri, 08 Oct 2021 02:30:22 -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 S238471AbhJHJbD (ORCPT + 99 others); Fri, 8 Oct 2021 05:31:03 -0400 Received: from mx22.baidu.com ([220.181.50.185]:37546 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238235AbhJHJbC (ORCPT ); Fri, 8 Oct 2021 05:31:02 -0400 Received: from BJHW-Mail-Ex13.internal.baidu.com (unknown [10.127.64.36]) by Forcepoint Email with ESMTPS id 8ED51C1322428B822802; Fri, 8 Oct 2021 17:29:05 +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; Fri, 8 Oct 2021 17:29:05 +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; Fri, 8 Oct 2021 17:29:04 +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 , Philipp Zabel , , , , , , Subject: [PATCH v4 3/9] iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe() Date: Fri, 8 Oct 2021 17:28:51 +0800 Message-ID: <20211008092858.495-3-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211008092858.495-1-caihuoqing@baidu.com> References: <20211008092858.495-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex14.internal.baidu.com (172.31.51.54) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) X-Baidu-BdMsfe-DateCheck: 1_BJHW-Mail-Ex13_2021-10-08 17:29:05:603 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..440bf28e0605 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