Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4940971pxb; Tue, 28 Sep 2021 07:21:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBLBlT8kWScc50pu1RkJ3nlsVStTDiIsvkR2ldhgi8pO6BrU/1PRwvdW1ob7K0Loyr8/PV X-Received: by 2002:a17:902:bcc6:b0:12d:bd30:bc4d with SMTP id o6-20020a170902bcc600b0012dbd30bc4dmr4994166pls.18.1632838898736; Tue, 28 Sep 2021 07:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632838898; cv=none; d=google.com; s=arc-20160816; b=T4TUzvATI43V1KU9MLfa+Z3wYi+ySTb4PIaNbR4FhP2/k3w6D4yMj5+alKnNdJHK/R F9mOC9JmvZYRkBYISlP4WTpH3FpUU0ie96+rSIgvQLhs/UREjW1ePmPpYod2muD15kSG VRmP5HaunWbi2ry6esb0TmnABTH1IjIyqQNIUEVSjmEcrSemkjqcIVmRpgfbomZi0vyg 5yiG7mysVBGWCLVe/SLvi/fKTUTr4NSj3dP9nqd568TrRQpgtUEmIu1dszbBYzlnaKm/ knvaOyc5P2KltIrOJSKfLByosrtLNKGMO2AbVP2i8JC2Gd5WWQoXNFvQDfNcJG6kgDiS toig== 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=mrelymdARs3OIDDujdl7Rz/1/gXFaSDgY+1QfPIebBsAcH4PED28Rfjdbi62y6Y9GK GQGiOhu+TrW/YhyZJHD7k17+2tVHPgRd3inoWhnCYkYuvpipSv1F5tgv5VJj2EEiNQSh Y3CRl8ywiCdBmDwWqjvCOxqM8jY6l+BkUl5tsAD66LwnzxvUK6aQ3D5dFiMTg9JkeEVY PQ2FiDKNn6gwGYa6T0HaQ1MA9/SpD5hPT8ZwLoiHiYrYzLbGImjI5xmkoA9tkLwP/v58 jM/lBJ4016Sb04sUsfuvl+lUr3fAzPOJfhKO+KDMMi7tg6gcUUxL/6Bnh85+7P5PX2/m MeOg== 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 b15si3178020pja.124.2021.09.28.07.21.23; Tue, 28 Sep 2021 07:21:38 -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 S241152AbhI1OVw (ORCPT + 99 others); Tue, 28 Sep 2021 10:21:52 -0400 Received: from mx24.baidu.com ([111.206.215.185]:48514 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241003AbhI1OVw (ORCPT ); Tue, 28 Sep 2021 10:21:52 -0400 Received: from BJHW-Mail-Ex02.internal.baidu.com (unknown [10.127.64.12]) by Forcepoint Email with ESMTPS id 446133CB622D7C7A9271; Tue, 28 Sep 2021 22:20:10 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex02.internal.baidu.com (10.127.64.12) 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:10 +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:08 +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 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 22:19:48 +0800 Message-ID: <20210928141956.2148-2-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 --- 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