Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4471706pxb; Mon, 27 Sep 2021 18:38:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaPOC8oIdj3KlXgVpm/V61ptMAUmJ8yMM+6gXai+OHgvIY82sk53paN+Mgm1vSJKVH76Q9 X-Received: by 2002:a17:902:bf43:b0:13e:28f8:9e84 with SMTP id u3-20020a170902bf4300b0013e28f89e84mr2789035pls.58.1632793090527; 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=TmSfIeWJ0Q5+/jUJ7fdDjhVuVR23vNLdgvWN4ZNBv4h+N9McMKidG3yjBbUVaVgA8u p+fa2F8JsNiorBq4IQ5fpzR5r/K9TWZMGZ7Zp1G6l30JWeooKxe6403p3wGHotaCMiTH ByNLkO3G1ddqqhb4NNrfVYXTFQBBXGcXf2qobV0D1+puASxXlqi0SGJawcrO6tYv9Dnt wno+8rdDoZ3Thbjl41ybDHieqUedVZpWeJqykKnby2ts8ykKKvMKvaG7GWFyIqaSolTO lmO2yMvSak2iy4qcPBXA2GUERKqEaC/49XwjYpGleVzYshI/CIjJlIaMreP9t+vFW2uz X1Sg== 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=t7CPTtjPQX6BIE+1uSXTXBniBRq4l6a+jaT9MDWnfxM=; b=xPPIFSNOk+MKH51zTcU7gRfQXdoezOuYeJXbHrxRTUsp/4bbJXVEp0PdB/ikaRsE3E W6oyPmuBNcFd2I31ChzfHGtl7O8epbAZOpzdCSDyv7TAMGON3AXqtmmEHp+176NbK3I4 huyBZQnTIYi4LJBlZRr+Kwwx+zW4AKXoMPEW2kTaQEnJX/PwD88i6feOj+xtL0jmv5OX BCCB+Zdg1fYVddzeyn/ZSSMDzvMY2hehqQ3W+ZYdNlimBaNN7cbISRF5udEK2m59/ILa aVW3gzxK2fLRuHu2BPZFW8msucMrj7wN8zKN7q41QVNkmngcbB6CiTxngnBX/L1AT2wA FFEg== 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 x3si23603217pgp.147.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 S238479AbhI1BiW (ORCPT + 99 others); Mon, 27 Sep 2021 21:38:22 -0400 Received: from mx22.baidu.com ([220.181.50.185]:44700 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238428AbhI1BiV (ORCPT ); Mon, 27 Sep 2021 21:38:21 -0400 Received: from BJHW-Mail-Ex14.internal.baidu.com (unknown [10.127.64.37]) by Forcepoint Email with ESMTPS id 208B825A85D16B02446B; Tue, 28 Sep 2021 09:36:35 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex14.internal.baidu.com (10.127.64.37) 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:34 +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:33 +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 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:36:13 +0800 Message-ID: <20210928013621.1245-2-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-Ex14_2021-09-28 09:36:35:088 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/imx7d_adc.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c index 4969a5f941e3..f47360cbff3b 100644 --- a/drivers/iio/adc/imx7d_adc.c +++ b/drivers/iio/adc/imx7d_adc.c @@ -496,19 +496,13 @@ static int imx7d_adc_probe(struct platform_device *pdev) return irq; 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