Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4471757pxb; Mon, 27 Sep 2021 18:38:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEYYw/b1PiOnFlbnqu6hJrPc0j3LfbVmxd7A91CY20CdPIj7Atej1v79TGRKGt3CoiAgZI X-Received: by 2002:a05:6a00:1628:b0:447:99ac:cc2e with SMTP id e8-20020a056a00162800b0044799accc2emr2965480pfc.1.1632793093349; Mon, 27 Sep 2021 18:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793093; cv=none; d=google.com; s=arc-20160816; b=oljI4tYIySOypON536d0xuRTWq4dOmL9Dai/aismYOYwaEOtVqtzuzZd8/cHSLLcuz WfzypVGDHoc+OFAK4fTjKvpObM07i2NUBoDoWKCrubyZsyte9Wz711fiOVnSgnqcP1Jk IfVZIJo5mjw7qIGeIDsTjIWNNkqQNA/7SYND1YPKdECjmPz8JtLWbs8KKBR0zHs9W1Rf guEbyxHjf5Z2JM3kTD2qNCesI72mfPzfnHPl3QXcnQhKQ+uiLLsTe/HbHyofXrfSwKK4 ULuMLw9+f6GF7WhFt8tbLsOnAWZE2WRgyVvMaxsE0M7+mPGLnXP9tjmChUhYlD9u++Oa fRHw== 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=b8PkSYM+45/xEbhAGAGkGd2e6XdXgVBx2XSgqNUB/ftRsMqpQ/vL7a6Lz04vxCMl/e TrqfrY0yh5lStJMUcc8xhnwy0BWY6v5DE1c3n2vkQmOh/4I0kvQoSwUHiaQvaQCAubWm fBHqkRldSgXNJ2MAl0TLnDebzaw6V2J2OhpdiZVH/nVX1Sf86pFLR95Hj15JEMPcytMI qYxHzgMO7dUw2KeryFyQjiwRJ+3fy5xadtGlEjs3y7mTaq+vKvq+n5U4LXHkkwb/EVta JSGxoVMzESZPPK0b3Llzkyd+dvdNwGrJg0yoO9m3/Ec2nhSkpFazrjFdgQJxBHdyr3lw 4GNg== 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 z8si23320599pfj.235.2021.09.27.18.38.00; Mon, 27 Sep 2021 18:38:13 -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 S238510AbhI1Bi1 (ORCPT + 99 others); Mon, 27 Sep 2021 21:38:27 -0400 Received: from mx24.baidu.com ([111.206.215.185]:44972 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238492AbhI1BiY (ORCPT ); Mon, 27 Sep 2021 21:38:24 -0400 Received: from BJHW-Mail-Ex12.internal.baidu.com (unknown [10.127.64.35]) by Forcepoint Email with ESMTPS id 9DBDD7062CF43DDFDA95; Tue, 28 Sep 2021 09:36:44 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex12.internal.baidu.com (10.127.64.35) 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:44 +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:43 +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 4/9] iio: adc: max1118: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:36:15 +0800 Message-ID: <20210928013621.1245-4-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-Ex12_2021-09-28 09:36:44:629 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