Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4941116pxb; Tue, 28 Sep 2021 07:21:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUqWo5BHgtTArJiU67YKgIUzcWngYBd20YGwzD/cpDTKB4Ef9vz9mlmvRbJPZGMTSdT07h X-Received: by 2002:a17:902:7144:b0:13c:8d49:fc46 with SMTP id u4-20020a170902714400b0013c8d49fc46mr5348391plm.45.1632838910027; Tue, 28 Sep 2021 07:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632838910; cv=none; d=google.com; s=arc-20160816; b=EJFP7ABQI3klEdJoVoGFGWEyWFu9EQpQzhCnDhKeUUam49Nct15tkSt88HtIFyAEFd Kn0vFyeJ64gnTq04nUZZ1HUZ7sOQ9VebgiUd9JfVP7ozkl2ZyrQtsMgVuPBGQx6xs+2q eyxvUA9CXm88fEpGJ7igYCAGDh2YoyWvebb/KhTgQ8sw/ELZkFJ54Jn1X9i+aaJ97cuk vgMu8Ad/PhUMf8jDoCrmSuseBRlAOqIEMCTmPZhCz2edZx6mJFb5i8O7W36xKUodD2bq W9nUETOgsp1vMqYCnZQArn9rxFtNYd2HPv9J0RacBAaNp/PMJfigmEbfz7qKTLbHOdPx bLaw== 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=KdUAiqfvtR0/QdCDDK+dc9krWzFO3gs2I15/myBbAm0=; b=O/OpjYkMoV3nct5k220yLHe9RnYtSJtT27znvoMINO5+7MynARUU9p25ndqxeO/jbP etu++ES1sCn606BJTo920+X67lkS6WAGAGXEyf6uIEUPkCtg851/+G4bfaPK90Dc/KfE 2ntBQZe15IRNH7AYV1p/uSinrCD2aNg+V6dR+BY/7J9HK533bbFcDgXYzfa2hspsOGsY iroFfkWlbAC5UYgHDLj9nlmlJ0wMx3M+rpxQrnhIKYPlLivvHyqc9LhiXSbms0GoRN9m lWmb4aYN0Rx5QuV+UmBVNvy16GTcz2WY+umEliH5j3j2qXigoahS57kNWYYBnUHnlRKb f86Q== 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 y2si3247293pjg.116.2021.09.28.07.21.35; Tue, 28 Sep 2021 07:21:50 -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 S241218AbhI1OWL (ORCPT + 99 others); Tue, 28 Sep 2021 10:22:11 -0400 Received: from mx22.baidu.com ([220.181.50.185]:49006 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241250AbhI1OWL (ORCPT ); Tue, 28 Sep 2021 10:22:11 -0400 Received: from BJHW-Mail-Ex10.internal.baidu.com (unknown [10.127.64.33]) by Forcepoint Email with ESMTPS id 02B3954948E5B884FAF2; Tue, 28 Sep 2021 22:20:28 +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; Tue, 28 Sep 2021 22:20:27 +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:26 +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 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 22:19:51 +0800 Message-ID: <20210928141956.2148-5-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) X-Baidu-BdMsfe-DateCheck: 1_BJHW-Mail-Ex10_2021-09-28 22:20:27:974 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/max1241.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c index b60f8448f21a..130ca8dc6fa0 100644 --- a/drivers/iio/adc/max1241.c +++ b/drivers/iio/adc/max1241.c @@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi) mutex_init(&adc->lock); adc->vdd = devm_regulator_get(dev, "vdd"); - if (IS_ERR(adc->vdd)) { - dev_err(dev, "failed to get vdd regulator\n"); - return PTR_ERR(adc->vdd); - } + if (IS_ERR(adc->vdd)) + return dev_err_probe(dev, PTR_ERR(adc->vdd), + "failed to get vdd regulator\n"); ret = regulator_enable(adc->vdd); if (ret) @@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi) } adc->vref = devm_regulator_get(dev, "vref"); - if (IS_ERR(adc->vref)) { - dev_err(dev, "failed to get vref regulator\n"); - return PTR_ERR(adc->vref); - } + if (IS_ERR(adc->vref)) + return dev_err_probe(dev, PTR_ERR(adc->vref), + "failed to get vref regulator\n"); ret = regulator_enable(adc->vref); if (ret) -- 2.25.1