Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4944185pxb; Tue, 28 Sep 2021 07:25:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5GWefhgefxF0nuYLpbDcNnDEVcxOMEOoM3K0WNNb0floMHyhWQK/9OfjDLnCFr06PRGej X-Received: by 2002:a50:e0cf:: with SMTP id j15mr7968539edl.23.1632839136238; Tue, 28 Sep 2021 07:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632839136; cv=none; d=google.com; s=arc-20160816; b=0zHzed93YAtvwUlBzQ6TLhD8GiWdJp4YUJxkKFJkGuSRFvjSGEDGhBQcNDjm7P3NgM DgzJNtcqdLI6GTJoAMgfA2d4ujop4W1OS5BefQjEktd9I7aG81RF1m/9tQLnww8FS4Qz I7qKbaTCDfIIcjStgnzsry3+ONvg1bGv9fiasUQDwpxHXTTjeiIggtHA7wdXnGJG5pND 4EfpKOSRkBTtd+jENdVy4sZe0T9eR3fDtYxGm5qGmfxgutnsWlkBCrktnULhOKXh67kz Y5nXCxBnLIiAZaRGB+rp7YwoenmZWrqhqfd/6Kiya+lFPOeS7ZiN4GTzSRar0B9989eO Ct8g== 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=/nbZzK/9QXI7/aPLL6eooNivfHjOElIn00MJQqo9b7k=; b=z+aWvn0VHu/hXF+6cxt2PVCoQkRqdDDPQLvDF+9DiHzgJH0F+nGZsuscYUVAVWHwbF bcCLK8kFhybZ+K5JZ4Q5LGjSmHBInWcRXhRcMZKU/04DLvaKqS7xGNugMhp8QkWPCpDC V7cxN/xT9hsGqMoenNa+qa22Dbe+HEniViZLY2+zZsT8iuJUhZmAUvlFh1FmJZOD3y2m QMEN8rush4k9HFxs+sWlnK3o6y46rOhi3JVS7p5au2OU5FG4oaed74HS6pKVJwOefn0+ Bet2mFEMF5LsUSCRCjMdJSXVrW+9JaP01bU2ahWfYXsjwSNx7lw4eTSH4Z5Wc4fVdHMp HRhQ== 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 l17si22715662ejh.84.2021.09.28.07.25.10; Tue, 28 Sep 2021 07:25:36 -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 S241293AbhI1OWT (ORCPT + 99 others); Tue, 28 Sep 2021 10:22:19 -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 S241267AbhI1OWS (ORCPT ); Tue, 28 Sep 2021 10:22:18 -0400 Received: from BJHW-Mail-Ex15.internal.baidu.com (unknown [10.127.64.38]) by Forcepoint Email with ESMTPS id 523BC493CB6E644C1996; Tue, 28 Sep 2021 22:20:38 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex15.internal.baidu.com (10.127.64.38) 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:38 +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:36 +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 8/9] iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 22:19:54 +0800 Message-ID: <20210928141956.2148-8-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-Ex15_2021-09-28 22:20:38:298 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 --- v1->v2: Remove the separate line of PTR_ERR(). drivers/iio/adc/rockchip_saradc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index a56a0d7337ca..57419ccb3c70 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -392,11 +392,9 @@ static int rockchip_saradc_probe(struct platform_device *pdev) } info->vref = devm_regulator_get(&pdev->dev, "vref"); - if (IS_ERR(info->vref)) { - dev_err(&pdev->dev, "failed to get regulator, %ld\n", - PTR_ERR(info->vref)); - return PTR_ERR(info->vref); - } + if (IS_ERR(info->vref)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->vref), + "failed to get regulator\n"); if (info->reset) rockchip_saradc_reset_controller(info->reset); -- 2.25.1