Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2177415pxb; Fri, 8 Oct 2021 02:30:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYfi2InOh9pasOd05GSspLw8IuQv5+HC0I6UeQkB2YWv9awdLgsT2orI3GHhS02Lpj9ItI X-Received: by 2002:a17:90a:9f95:: with SMTP id o21mr10331941pjp.21.1633685405522; Fri, 08 Oct 2021 02:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633685405; cv=none; d=google.com; s=arc-20160816; b=KaQz3zv06oHQBy3YFAWctnJ+b33QN1KDKhItGpqrEi4J3mhIFk5e63nnBOPxpw2JzK g2LyVaTi4AkCvCZ0GPMv2uX3YTjoW4fh4qTUSXTOwc20O5WFkzRxnrJ5orwiFn4F257I Bix5xkAiS0cItcPikjcU6Jiqk4pX2lgOuYol6+44TCiXrZSncJNHll/snLu6hUzeEIxs 9kvj/j6lHECAzFjXU7zSgWfd+hXJau5sFacLv3coIWopGEI+ZrRzo0X+BSzMz+U+Gj/s 9bV+jJ02ErZpF1emncuXPN13i0cFTnExxuKlPKawdHIBG7DwoWa5yLQhB3Z8ROn0HKn1 uPww== 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=OW7ER0RM6xyWZUQeMdYQVvr7fiFzCK/Is99ZHJImiXs=; b=hj6PBdc34WUY9ZPP92I9G2eymvSIhuH5+DIIJehMtLZiYKsjEoDvs1uUmoPGhhYF5t iSTeC1ZcxB5pHLt1W2Dv3lE3Ng17fWxzUJvq245ZgwhZ9jawwNN6gyp6zsjxZsfzsyZl nrRG9kXZOzqXV7vkXyvhvLLoZ1QuhaZ/U64BcKrXhHlUKzPFcenJPEZnIjM21uI1xWSD ZHamKDH5AZQsaUrbJRaNsI4SXcnE+M5z+Pr4k+1TW0SlayYU6PDQR5QcMpJKoa4oB4FL ungbYCV7hHfI3EKNONRqNrdCLE1VjjFX9Z2G1DYCujAGzJ6P80HixaliHvxk7n+nIPwu e7/g== 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 q3si3620182plh.283.2021.10.08.02.29.52; Fri, 08 Oct 2021 02:30:05 -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 S238091AbhJHJbA (ORCPT + 99 others); Fri, 8 Oct 2021 05:31:00 -0400 Received: from mx24.baidu.com ([111.206.215.185]:37394 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237801AbhJHJa7 (ORCPT ); Fri, 8 Oct 2021 05:30:59 -0400 Received: from BJHW-Mail-Ex10.internal.baidu.com (unknown [10.127.64.33]) by Forcepoint Email with ESMTPS id 8BB20F70243F7C8C237C; Fri, 8 Oct 2021 17:29:02 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex10.internal.baidu.com (10.127.64.33) 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:02 +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:01 +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 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe() Date: Fri, 8 Oct 2021 17:28:50 +0800 Message-ID: <20211008092858.495-2-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-Ex10_2021-10-08 17:29:02:534 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 --- v3->v4: Handle platform_get_irq() that returns -EPROBE_DEFER. drivers/iio/adc/imx7d_adc.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c index 4969a5f941e3..d69d8b7d8456 100644 --- a/drivers/iio/adc/imx7d_adc.c +++ b/drivers/iio/adc/imx7d_adc.c @@ -493,22 +493,16 @@ static int imx7d_adc_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq < 0) - return irq; + return dev_err_probe(dev, irq, "Failed getting irq\n"); info->clk = devm_clk_get(dev, "adc"); - if (IS_ERR(info->clk)) { - ret = PTR_ERR(info->clk); - dev_err(dev, "Failed getting clock, err = %d\n", ret); - return ret; - } + if (IS_ERR(info->clk)) + return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n"); info->vref = devm_regulator_get(dev, "vref"); - if (IS_ERR(info->vref)) { - ret = PTR_ERR(info->vref); - dev_err(dev, - "Failed getting reference voltage, err = %d\n", ret); - return ret; - } + if (IS_ERR(info->vref)) + return dev_err_probe(dev, PTR_ERR(info->vref), + "Failed getting reference voltage\n"); platform_set_drvdata(pdev, indio_dev); -- 2.25.1