Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3756216pxb; Mon, 27 Sep 2021 01:38:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3gl9Z8y6DKV1967+q2F5xnR8aqhRW5tVVxh8DOyU684eBL+GCTH7hKiw+e6sii4JUr9bN X-Received: by 2002:aa7:c7c2:: with SMTP id o2mr21413320eds.166.1632731936516; Mon, 27 Sep 2021 01:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731936; cv=none; d=google.com; s=arc-20160816; b=JtCKOfSHY4jeiWmB1GV7+KKBi3jyJN/UNOxS4zMFyECwfAVQ1qWlsxoWSx6TUZt5kl RQBv/eX0ZKBIiTn9yxx0hX33Qe89wGChi5TvJUFDkn/QHkwrSmaLDMneOmdowkY/Grdy D0MoTyXCL3Yyzld9F/3Oyu2oCxi1Nnbcg3VBihkQtZgYAusbOFk6AsCdya+9woMfuOpj IwH4hQ3SxJkFvYngO5uqgYUcSbjONssTUOuWxioe9XtUqaT+/WsKlEzYmkv6CzurZSwc xEFvIDH2HnrhfOcEK5Nw6/UqbU6oYhcGwnymvzvVpaoQg3xRt1ej7TZCzP0y+WjTkERw dFSQ== 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=cj03g1TpzVE+izu2CkOiWcUzkBlXmIEKn3w7FciW0RY=; b=Ek2gHTTB4ywArP6MuookJHRht/3Z4HrD1egMVSHLrj3Cd8ALYB1669CnuTlNo86oH6 HCVxku0914yzTlg3e+VFQ6xhgBXsENGUO3UMh8A0fgZd/9OBgY/EJjDQsu0ES0X9wrCp 70avu5TPTPW/f9BrvOX52OlZmq5nHpDU3/KoPeHxZNFv1oJpHK88NAhm16IIXOqDMq/8 D6I/1hVmTei5JPHzSUEqoGT3I1nf5xDbr/qmHStiuwCBw+WsIFHuhy7XCy+i2wbU1bii WOcLQp2H/xlxfNtVabZBdcFZlQZdKtR0jUG4xaW/MnuJJYVQs0g3D55z/qhzWdMAWuQ/ oKWA== 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 x2si21797773ejy.385.2021.09.27.01.38.33; Mon, 27 Sep 2021 01:38:56 -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 S233543AbhI0Iib (ORCPT + 99 others); Mon, 27 Sep 2021 04:38:31 -0400 Received: from mx24.baidu.com ([111.206.215.185]:43772 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233540AbhI0Iia (ORCPT ); Mon, 27 Sep 2021 04:38:30 -0400 Received: from BC-Mail-Ex23.internal.baidu.com (unknown [172.31.51.17]) by Forcepoint Email with ESMTPS id D9DF35C47651CEBA2483; Mon, 27 Sep 2021 16:36:51 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex23.internal.baidu.com (172.31.51.17) 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:36:51 +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:36:51 +0800 From: Cai Huoqing To: CC: Jonathan Cameron , Lars-Peter Clausen , , Subject: [PATCH 2/2] iio: health: afe4404: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:36:38 +0800 Message-ID: <20210927083639.1020-2-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927083639.1020-1-caihuoqing@baidu.com> References: <20210927083639.1020-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) 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/health/afe4404.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c index d8a27dfe074a..d58df52cca37 100644 --- a/drivers/iio/health/afe4404.c +++ b/drivers/iio/health/afe4404.c @@ -494,10 +494,11 @@ static int afe4404_probe(struct i2c_client *client, } 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