Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4471709pxb; Mon, 27 Sep 2021 18:38:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0lHb1Cpky1u7DdIDde9aGD6ZpaMltY2kC/4Nv8HkxRTk1ZAYcS8i+DCztjasCEE4B52kl X-Received: by 2002:aa7:84d6:0:b0:43d:fe64:e8c0 with SMTP id x22-20020aa784d6000000b0043dfe64e8c0mr2997328pfn.48.1632793090501; 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=vnXoM0gvYyIEQvwo+DGt4EyfSZn4+yASSo53lH64a4bYNFtCkId+cgAo1yv+ECXJ0Y Dxvc4gVzjJ9kD7N/EZ8edAlhcdsmrF/EPqB1RAqhBn+fkbGIWEHDzPlJg206mI3vu3tu kSs6hMLjJo7L0GK6LkSAXPh8XTcLTMsF5AhtjbeoHZBew71ORZ5KReEzjSOSg5wrPBoV ri4pB3a/ZPN5u2/YEEwnbHjYDhaHzpuUOHO697ZsGyhGkUs51ZOAFb2QQwkQCcIQi2t+ kwOTxUGj7qsr6uDG53y01RFQXhz6brJlEgKW5d6NQFBd3KokmHffoI2R6xdKtTOkDqHI uNXg== 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=lXud3ABdQKkt6sRmFm29dv1OkzZpfTYnOmggLxC4rn3JPvM6hrv5+HeudSd8ORg+dc Q8stFjsg2Z1tAXGKWEB1Tx7G7e3JagFn9FMuDe4V0fJ6gZHylkzc5jEQcf49cCVBhK4d Z1pvzdQwH1/rBXJR1EAHQLOlH/kJh2uxBc5HCh0/ZLOkE1e/Zki3HH/3c7K9OkJxc9Bz H/0ko7fVNbwLyDIyy+KQaPKpwgK3GV/js4FgeFHiqELwIjSBxU6W7/QPWYMiTJVQCoEh kP/mpGOxg5ArNEytj1D4jZ7F93eeYvTX3ULWUZx5p+5QdO+6D+CRZwW066z+roT4/EbC PQJg== 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 l6si26686051pls.421.2021.09.27.18.37.56; 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 S238527AbhI1Bic (ORCPT + 99 others); Mon, 27 Sep 2021 21:38:32 -0400 Received: from mx24.baidu.com ([111.206.215.185]:45160 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238519AbhI1Bia (ORCPT ); Mon, 27 Sep 2021 21:38:30 -0400 Received: from BJHW-Mail-Ex09.internal.baidu.com (unknown [10.127.64.32]) by Forcepoint Email with ESMTPS id E9E892C1BC5E2CA2B252; Tue, 28 Sep 2021 09:36:49 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex09.internal.baidu.com (10.127.64.32) 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:49 +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:48 +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 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:36:16 +0800 Message-ID: <20210928013621.1245-5-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-Ex09_2021-09-28 09:36:49:944 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