Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4476089pxb; Mon, 27 Sep 2021 18:45:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvFOr+1qsxcKMjC3U7gIFnbFXYv0OH8lCIfKDpiLiPbsINzBaLogFPqtvW2IW7hidRi3FM X-Received: by 2002:a05:6402:222b:: with SMTP id cr11mr4417003edb.392.1632793558962; Mon, 27 Sep 2021 18:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793558; cv=none; d=google.com; s=arc-20160816; b=I0nz8CiTv+HrByzUysKS0GqBD3aZy9Pe/pCL3vu9rn+3VLk8OhzqJ7o9hdQLjrsP8b 5gC4/IfdEYriJD6aQS0Aw9ZTMO8SK8fezIAtU+0gFyMocJ1O6I3O3CD16GNCwbaEt/bs P8gJewRMadli/hsOovGPHPysgZ44FKx4bItr8HiqJhR2bFRaLQFElf7SE8udOsVktNDu G1rrpOz8oLilPl/kSoCJnXLRwYO9wAYaMP9JHTLvHV3CAIDbiiFsSIUquPvKEG8THfE8 IqGB/M8L0tWsW4cPOl31jOrmxI0EwHotOMdbUCpbuIBRo6utnrHrRn23C3cCnzNQ5dMG LuoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=DYKtpJ7bWJtAobzpd8yl56m+YEHlS1J8OiyHrrQukuY=; b=Sexp5vykIBkSJNpeHD+TNoftJ0hoDgliIPpnvASmWLC3Cw4XAD0p/fIdurHEYexjbs sr0rplk9X7gryQDwtnEybqUrKGUOGqp4e4CujkKSydlbtoh2meRzp00NAmxdgpK/gvO4 eAHQhOsHq731efOkL9pY19xD2bdeGt/JPhmagSllXO4cnld8OcxX4VPGv7uf2wYOwAKG v6RnVjVzaHs4yXNunxm1iaWCGoICuj+Vklt4S4c4aUHxkD6vKOtu+EzBotskuHcLCRc2 /PLIEvux+1P0oW+P33PMCK3ZQgp79BM2hJa715qnav1phPWgVKqkmyTADdj5ZaqgThKR CKqw== 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 j23si23290133eje.719.2021.09.27.18.45.35; Mon, 27 Sep 2021 18:45:58 -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 S238516AbhI1Bpx (ORCPT + 99 others); Mon, 27 Sep 2021 21:45:53 -0400 Received: from mx24.baidu.com ([111.206.215.185]:52128 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238505AbhI1Bpx (ORCPT ); Mon, 27 Sep 2021 21:45:53 -0400 Received: from BC-Mail-Ex24.internal.baidu.com (unknown [172.31.51.18]) by Forcepoint Email with ESMTPS id 9ED15A863C84CDAD1107; Tue, 28 Sep 2021 09:44:12 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex24.internal.baidu.com (172.31.51.18) 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:44:12 +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:44:11 +0800 From: Cai Huoqing To: CC: Jonathan Cameron , Lars-Peter Clausen , , Subject: [PATCH v2 1/2] iio: health: afe4403: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:44:01 +0800 Message-ID: <20210928014403.1563-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex31.internal.baidu.com (172.31.51.25) 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 --- v1->v2: Remove the separate line of PTR_ERR(). drivers/iio/health/afe4403.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c index d4921385aaf7..3a8cfb669b25 100644 --- a/drivers/iio/health/afe4403.c +++ b/drivers/iio/health/afe4403.c @@ -487,10 +487,10 @@ static int afe4403_probe(struct spi_device *spi) } afe->regulator = devm_regulator_get(afe->dev, "tx_sup"); - if (IS_ERR(afe->regulator)) { - dev_err(afe->dev, "Unable to get regulator\n"); - return PTR_ERR(afe->regulator); - } + if (IS_ERR(afe->regulator)) + return dev_err_probe(afe->dev, PTR_ERR(afe->regulator), + "Unable to get regulator\n"); + ret = regulator_enable(afe->regulator); if (ret) { dev_err(afe->dev, "Unable to enable regulator\n"); -- 2.25.1