Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4941605pxb; Tue, 28 Sep 2021 07:22:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvZqUhdO7RafqhjsRW9E3jCytaFrxK44ktqz+gw7gWh29B0cIK6beyZHT7izRRxtp9k8k1 X-Received: by 2002:a05:6402:b12:: with SMTP id bm18mr7594131edb.199.1632838944743; Tue, 28 Sep 2021 07:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632838944; cv=none; d=google.com; s=arc-20160816; b=wUwkTLrq2WtNW0gQ1LviPGNjDjcZMkvNawB5II8QlUeua27Xw0MRXItY+bjHPNRcJk 74irXBCHX6A5k3jVIqPkhoBW+rrtorUlHpUSJMp960GmCP8y2rJJ7YzNyzd9zAvYSHZW UTU0706oS3F/SPYwuqUQ/Tmsh/CT4C1305N63SMYYaYHW2R8O+cRRUYQhiB8Ah8/+wvQ vgotIblSI5w9d3I/fByrtVS+5BZfXN2tX5nTFQaiP4kjHhH3uZl0JeYUc3HX9s4X8zY6 V7LJCaTMZ0BBKBV5sit14x8I2Bq3nNko7vf7AI0ytVhFxA1WUvQOmhy5aQ5WoFoLQ1lb 6GSg== 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=trnUG2Kz5X7izLiVJ2X2/PyiKJFuGgw6Fr5feGt71BSvspvRkjzw/6mOcaWQNCWACl RKIOza/pn6IdDsBpmbHk1gC2FSJkRAHaiMSxacZen2N+StDy6WHShpBYIleZDT1W2cGo jiU83miLInfvAKblcNw5vStUxito7CoBa1veJawdyp3D6+8k6YrbR/63sswytZ0pheUK MqeGbSbaAUezcapWSjotI/GixeweZV/jt+6Ywqhfzxo1KCuM3eh4uklc2jb45gf1pvSq SP6s1cq8n3Y+CRIXZKpKyTM1DTLaJ6KV3up8Sp24Rz1Dgsly/kVX3A/yX5qUUBUZ+gXo p3/A== 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 q1si20850045ejr.43.2021.09.28.07.21.58; Tue, 28 Sep 2021 07:22:24 -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 S241220AbhI1OWH (ORCPT + 99 others); Tue, 28 Sep 2021 10:22:07 -0400 Received: from mx24.baidu.com ([111.206.215.185]:48858 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241203AbhI1OWE (ORCPT ); Tue, 28 Sep 2021 10:22:04 -0400 Received: from BJHW-Mail-Ex11.internal.baidu.com (unknown [10.127.64.34]) by Forcepoint Email with ESMTPS id AE35FBE4A2BB5652BBAB; Tue, 28 Sep 2021 22:20:23 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex11.internal.baidu.com (10.127.64.34) 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:23 +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:22 +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 4/9] iio: adc: max1118: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 22:19:50 +0800 Message-ID: <20210928141956.2148-4-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) 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