Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4941270pxb; Tue, 28 Sep 2021 07:22:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd90U1nMXGA0LgWWqDhXiJW+iMBudqlOckwoEPr9XpI3EHAh3nw6SZZBB78CdS6w4eMNwI X-Received: by 2002:a63:1a24:: with SMTP id a36mr4764017pga.368.1632838921063; Tue, 28 Sep 2021 07:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632838921; cv=none; d=google.com; s=arc-20160816; b=AVKgqd4OujALSlRToRMZVSG+n0qcA/P2WpBhd5Q0El4B08nSGPJpxFa0mutVSCUp01 WIyw4xGxkOUx6xO/E3+/Ry3rXI1/5Jx8PyAlfuHj2ixeS+SZok0Vk/+f9pN9Jsc+B8UE u9OjkJ7uUT0U7E/7SyUsUsxScDPc6dYr27zr5e+kJo7EeG6k76c9qSIWcuNFHvKyLZoE EH/uT2MwOKiKOP9VFjaQFWT+II9DyxgeMKVlx5PTJccU9w/Kqx4rYPFuyzUUNbzVq/T4 PFQX3LjWQeX+VGR5NfkMGLF8n71LNeEIYv0kZva0wMM866eQT1f71j9GEp+jlt+3nQsf 6+yw== 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=FUMfGVKhVm/Jbm6F8klWUqTDJpL/xbhrR5IZDUg7cHs=; b=0VvKXiHKs292Mz4kekKQ7vpQGRMcHX7H0KOATGZl7x+Lj1YYM7OMTmrWEzfUCwEWCA nBtuvRaDQC1cl9bHGiGNhR+zcd8U+xyajDsAdQb6VjNRHB469Ahrwivk/zXM30bSnhr1 Kx3jmKDp+z78S35x1B6wmhAK8Jrm8xZkYnHYtu4kaGdNJxHPz8b1km3Mpd+l4gcfAnG7 yztLt3R2Oq8nFjpcj39dpUvvwpOD7UBhnoSOX5n9MFOo17egU3pn+fagJUuGenz/mA6w qKEzzXGW1KqP+p43apP2RpinBzpyPqiP5prJnwtzvOWFOa4fUpabqqOkPDw1h7avPcZW 37kw== 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 b23si1912197pje.44.2021.09.28.07.21.44; Tue, 28 Sep 2021 07:22:01 -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 S241280AbhI1OWQ (ORCPT + 99 others); Tue, 28 Sep 2021 10:22:16 -0400 Received: from mx24.baidu.com ([111.206.215.185]:49274 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241267AbhI1OWQ (ORCPT ); Tue, 28 Sep 2021 10:22:16 -0400 Received: from BJHW-Mail-Ex14.internal.baidu.com (unknown [10.127.64.37]) by Forcepoint Email with ESMTPS id F0E44CBCA506C48BBD52; Tue, 28 Sep 2021 22:20:34 +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 22:20: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 22:20: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 v3 7/9] iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 22:19:53 +0800 Message-ID: <20210928141956.2148-7-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-Ex14_2021-09-28 22:20:34:905 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. BTW, change the return value from 'ENXIO' to 'ENODEV', perfer ENODEV which means no such device. Signed-off-by: Cai Huoqing --- v2->v3: Update the changelog. drivers/iio/adc/qcom-pm8xxx-xoadc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c index 0610bf254771..21d7eff645c3 100644 --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c @@ -910,16 +910,15 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev) map = dev_get_regmap(dev->parent, NULL); if (!map) { dev_err(dev, "parent regmap unavailable.\n"); - return -ENXIO; + return -ENODEV; } adc->map = map; /* Bring up regulator */ adc->vref = devm_regulator_get(dev, "xoadc-ref"); - if (IS_ERR(adc->vref)) { - dev_err(dev, "failed to get XOADC 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 XOADC VREF regulator\n"); ret = regulator_enable(adc->vref); if (ret) { dev_err(dev, "failed to enable XOADC VREF regulator\n"); -- 2.25.1