Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3754686pxb; Mon, 27 Sep 2021 01:36:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynWqAEu3xzBK1Na91Ne3TL9NYaSIZ8yLRnd99CiFNJ7VjuRLQ7nbpKAtQX6EDL4uDuLqx0 X-Received: by 2002:a17:906:8286:: with SMTP id h6mr26559609ejx.383.1632731791443; Mon, 27 Sep 2021 01:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731791; cv=none; d=google.com; s=arc-20160816; b=sXOtbhQtQgzGOpV6NzY+VLadA4uy9uFiNGioVBAAP0HvQjEXUgadgDdJUxWQx/WWbE e1prd6m56ViATW4SAKz1X6/GEsTJ17k8EFu1NMLp9jYjdlZUX5amtnexML2Erg/9Plf9 pKytu9O2a3sIDuGUPIIn/gCf6nUIHzuTNP9D8+A35E/GX292DAeP5jrs3Wtu/FN1Ghjh 8D05gci7SPaZNfrt1Xcl3PduAPw46U4NRChx4NJkYj5XiO0YssXtToB5qdOZ+Douebzw qxbOeVsW64mtsdnEtgO/HAsIq5R0BXiqbEd6ZgxxPIzcKECFtCsCqhvNHmS+PnX5FgOc KWiw== 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=Ie4fL0JVd9GzvcllRMFpH1ZcHh2s0iLh9nIIpTut8/A=; b=saXfVnRtIMwlDjmxwJLSYJpmmj1y48Cg+IxfhU0fThokcqvJ3Wbjt9QKRRxVvX95pI ZZee8BZDLWJPsQKkrZiMa5yZIYu22+y2jpoy+iY3VtS/NLxaLamXvJR/EkCRFujykktk nqmYV4PKv+qeXvENRGdcryh9wFxSyTUGr3QHwcnDBhYkYYQUD/8SRHQWhwUK2ePz0UmC i9dtoze1dU0q45/sZOycFp51aXHpbb5NMKH15phGtVSYjehXpahxg0kaKfq0YWR6UUWJ aufuMOxOxe4INULzZXgZM2cQsmNg3WgJrXYFneu7QnQ7BTySZSAXJIc05xttuRV5t2r4 L8Gw== 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 oz20si17712521ejc.688.2021.09.27.01.36.08; Mon, 27 Sep 2021 01:36:31 -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 S233500AbhI0IeE (ORCPT + 99 others); Mon, 27 Sep 2021 04:34:04 -0400 Received: from mx22.baidu.com ([220.181.50.185]:39176 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233417AbhI0IeD (ORCPT ); Mon, 27 Sep 2021 04:34:03 -0400 Received: from BC-Mail-EX08.internal.baidu.com (unknown [172.31.51.48]) by Forcepoint Email with ESMTPS id BBCFDAF2228435D522BC; Mon, 27 Sep 2021 16:15:21 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-EX08.internal.baidu.com (172.31.51.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:15:21 +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; Mon, 27 Sep 2021 16:15:20 +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 4/9] iio: adc: max1118: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:14:20 +0800 Message-ID: <20210927081426.762-4-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927081426.762-1-caihuoqing@baidu.com> References: <20210927081426.762-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex10.internal.baidu.com (172.31.51.50) 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/max1118.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c index 8cec9d949083..a41bc570be21 100644 --- a/drivers/iio/adc/max1118.c +++ b/drivers/iio/adc/max1118.c @@ -221,10 +221,9 @@ static int max1118_probe(struct spi_device *spi) if (id->driver_data == max1118) { adc->reg = devm_regulator_get(&spi->dev, "vref"); - if (IS_ERR(adc->reg)) { - dev_err(&spi->dev, "failed to get vref regulator\n"); - return PTR_ERR(adc->reg); - } + if (IS_ERR(adc->reg)) + return dev_err_probe(&spi->dev, PTR_ERR(adc->reg), + "failed to get vref regulator\n"); ret = regulator_enable(adc->reg); if (ret) return ret; -- 2.25.1