Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3755517pxb; Mon, 27 Sep 2021 01:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjiALLULOfhNy/723L+KTZwBSPjaVsyFBTyX2GYwX//DrNVAN0lKYfTgiwyPfeIixgITEp X-Received: by 2002:a17:90a:ee82:: with SMTP id i2mr18196026pjz.166.1632731869928; Mon, 27 Sep 2021 01:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731869; cv=none; d=google.com; s=arc-20160816; b=NTOMUk8nACW03RVCQmmLbzfVoGgzDwya2JiB+kxT9klW48TP/xjj91qfhZyDrlx7N7 OpyqYbkZtAoCF5u69yaMsV9FXw7jFajylNZpEpNhHQWbu8RBM1M4n0ErAPPfGxIRs48d s+lo8MPpiEdmJN7bluKAl4Et/KOonOpDEytFrykI9KJ4ZdMpy2XkxPLzQ7T7plcdGJFd zgOfWL4vgI+1oYLBYPCaRZ/0CmtPCkCI9RW59hnfQVHcGehGc0YFFk/20i8xEfblYmsV FpW51iwOVySY6yGK2fD0/eMkf5R0y2MdITdZs6USVogqSMYUgkazF5YTutk/1uR9IlZm AxQA== 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=aJgRPMlzeW/4xUKeSF4i/vtOVhIOYfnPxZ2+Ha5UYnk=; b=csiCKQoduRt2QNLrzeyNcfvBpGYeJjarzOAPkKdNqBfW0DC/q1VufpR3SecCC3W7U8 +oDsyT1D+9Yc/ZzA7H3Ds7g5V06aTeJ2Np7U/LrKxexWVFF4mDunSDjRkAzJUvF1X+G1 aZkFBUutr4oCnj6c11gUL5v5YAG6yrRxqtId2JOGCj2Ju/K4HiA2ejcg5Ibi5EJkJbvb 54qsvKnCm9aI7s8BidOztt/V+Nzr4Z4JZNFsZR5CM9LnU20cqsSET6x/9OwdC94DxCNp 1g0J4IbwPieKYn25ZNCyhuqT+WT2KHhqCnK8J0UkGvp/b1yb1P6NEtWDoN3fbuMKT8iP S/wQ== 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 41si17586784pjz.14.2021.09.27.01.37.37; Mon, 27 Sep 2021 01:37:49 -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 S233522AbhI0Ii2 (ORCPT + 99 others); Mon, 27 Sep 2021 04:38:28 -0400 Received: from mx24.baidu.com ([111.206.215.185]:43738 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233403AbhI0Ii2 (ORCPT ); Mon, 27 Sep 2021 04:38:28 -0400 Received: from BC-Mail-Ex24.internal.baidu.com (unknown [172.31.51.18]) by Forcepoint Email with ESMTPS id 1E980297C0D2E23D124C; Mon, 27 Sep 2021 16:36:49 +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; Mon, 27 Sep 2021 16:36:48 +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:48 +0800 From: Cai Huoqing To: CC: Jonathan Cameron , Lars-Peter Clausen , , Subject: [PATCH 1/2] iio: health: afe4403: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:36:37 +0800 Message-ID: <20210927083639.1020-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-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/afe4403.c | 9 +++++---- 1 file changed, 5 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,11 @@ 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