Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4472516pxb; Mon, 27 Sep 2021 18:39:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDVBA2xz+F+17BXw+pN4T6f2UuapH9CTlRfBhK7JV6nqiDRFCozfuQrXjdMEskZSP9dwpn X-Received: by 2002:aa7:97b2:0:b0:439:14a9:2bf5 with SMTP id d18-20020aa797b2000000b0043914a92bf5mr2690554pfq.45.1632793180597; Mon, 27 Sep 2021 18:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793180; cv=none; d=google.com; s=arc-20160816; b=uiiPDrZi98VRC+QBqrQBJLJKyu9jGH16s9udRulTPFlmRqLGII4+yJJSmNRWdnK3+d duZXde8bmCbUGuDHzCelFl9lUi/1lOHtTkKw2svEe/kDb123q7/YorDnhwMPdCzw3r8Z a3yTMXpKFyKajLjGXUNmFWvqyQWzlboCinbbvGANIonFJaVJK88nf78ruqPG47YHh1Al PQJ4CWXmTwgrg8nfNh8LrjGIzQo8aLUEWkByOTQVRCl20gC96U88ZN35HusluI0wv73s 6VLmeZ94BdZ3ApVQAZ91FcUgEph0nl5dJ+Gngg0P/hA5q1U5Ge1FU4L9XQ1zSxmGuKO1 bo5w== 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=eenHPGKy6Rhk+vxPpaYgmr9Zn5+Zylt0oPMecKPWfP0=; b=pO8/CdSF/FoxnkIjelyA7BawpfDjIqvIVCqEpJKqUhUL8QVcDqEseZkcjzG9inXSgZ 4S7/8JvM8Ublt5XGyq5c/WQWf4gVYGpr82F5W0mjSt2VBrr8JaT85k9tQANnWx33t+yv MPbfMzmcKtXPxNB13emLN6LKF7oXwkOfV4YF5JkMOfZ+dztA2dn9f75S36HZUAzSeGgZ 7lYQUkYCYVvf1Y6IKItBBSvU0T5NfzNy/xPD9EVXlp4x9yFlwsym1gVuLO+ZKBhxKi95 2YpWx/cQmVSrhGvmsKDrdvLRS59OeQKrYBbIj6MmUWlJYf4qppENM2jo5GTlnsuVvWCY e6fQ== 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 25si11005465pgy.483.2021.09.27.18.39.28; Mon, 27 Sep 2021 18:39:40 -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 S238555AbhI1Bil (ORCPT + 99 others); Mon, 27 Sep 2021 21:38:41 -0400 Received: from mx22.baidu.com ([220.181.50.185]:45484 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238535AbhI1Bii (ORCPT ); Mon, 27 Sep 2021 21:38:38 -0400 Received: from BC-Mail-Ex16.internal.baidu.com (unknown [172.31.51.56]) by Forcepoint Email with ESMTPS id 7F3964202A672DB8542A; Tue, 28 Sep 2021 09:36:58 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex16.internal.baidu.com (172.31.51.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Tue, 28 Sep 2021 09:36:58 +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:56 +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 7/9] iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:36:18 +0800 Message-ID: <20210928013621.1245-7-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) 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/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