Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3743741pxb; Mon, 27 Sep 2021 01:18:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2jRf06B22GhhJB7Ban30/deFRis0BGQS/5xgXlOkFYeHRk62lby3ROa6p4jUOndErHwHW X-Received: by 2002:a17:906:1945:: with SMTP id b5mr25190339eje.347.1632730722559; Mon, 27 Sep 2021 01:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632730722; cv=none; d=google.com; s=arc-20160816; b=Tg5psuJwKMSZrr28SAOfCv1wDwy0VkVayt45sOOMc4pNwxosYOx/aUh99f4HJmlZRg aVI8Zpk01Y0AJiNXeeua6UD1iM5zfKCVMcJkfOeNE6a6FsKXGzZMGsjW0G8HdGMbW2c9 hSmOT1EaQjbOF5V75ZTG6W2MGNhRSV/g6C8o1VffqD9Djgz70soCodD6+Mi1gYuyeniu NtNM6kLEnhPMctqIZZEE3Urn3AldCN93jC+S0BONbUKqbrGE/aDE2/rdzL5l+CEp8hnS icfWTvB/DaaG+cq/iF8JogCy/ry3jWJ5k4qcrzriwVt24SnwR9TOxdgq3Hu90EZasjDz RA3w== 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=KdUAiqfvtR0/QdCDDK+dc9krWzFO3gs2I15/myBbAm0=; b=YrWjT9p6gZYT8ZidAT4JiybXtmFjYP3uhTJbx35iB2FfyDDNNdaVtR37+T9CAGcXQv 6mlQlBMNGhSy8pCObZn2gVcCiEUq+L+NcCKq3aKna+jOad/7pbTdMXAxuRAFy8JdoBwf rLI+WhHV6WW/LMzEXS8h/Z5RjHgSZQ4cTwpWhKdtFpuD/MT/PCWozUaSxhcbflUZgrCP LTa96re8TwhABH2Q4V4IDGyar52k7g5kqB1+TFIUOKR7U0IyE3tGSCozdIzv7Fyx4ma8 vxpOcUbllGKxpRejdLrVOqnrCOfhEdfRwWnP1pfKKct/bB3R8zQWhUKBYfmqOdbh/84N iAHg== 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 u2si21335654ejy.557.2021.09.27.01.18.19; Mon, 27 Sep 2021 01:18:42 -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 S233406AbhI0IRE (ORCPT + 99 others); Mon, 27 Sep 2021 04:17:04 -0400 Received: from mx24.baidu.com ([111.206.215.185]:44568 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233349AbhI0IRE (ORCPT ); Mon, 27 Sep 2021 04:17:04 -0400 Received: from BC-Mail-EX04.internal.baidu.com (unknown [172.31.51.44]) by Forcepoint Email with ESMTPS id 2B24B2BCEBBD1C737EB5; Mon, 27 Sep 2021 16:15:25 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-EX04.internal.baidu.com (172.31.51.44) 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:15:24 +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:15:23 +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 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:14:21 +0800 Message-ID: <20210927081426.762-5-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927081426.762-1-caihuoqing@baidu.com> References: <20210927081426.762-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex10.internal.baidu.com (172.31.51.50) 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/max1241.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c index b60f8448f21a..130ca8dc6fa0 100644 --- a/drivers/iio/adc/max1241.c +++ b/drivers/iio/adc/max1241.c @@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi) mutex_init(&adc->lock); adc->vdd = devm_regulator_get(dev, "vdd"); - if (IS_ERR(adc->vdd)) { - dev_err(dev, "failed to get vdd regulator\n"); - return PTR_ERR(adc->vdd); - } + if (IS_ERR(adc->vdd)) + return dev_err_probe(dev, PTR_ERR(adc->vdd), + "failed to get vdd regulator\n"); ret = regulator_enable(adc->vdd); if (ret) @@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi) } adc->vref = devm_regulator_get(dev, "vref"); - if (IS_ERR(adc->vref)) { - dev_err(dev, "failed to get vref regulator\n"); - return PTR_ERR(adc->vref); - } + if (IS_ERR(adc->vref)) + return dev_err_probe(dev, PTR_ERR(adc->vref), + "failed to get vref regulator\n"); ret = regulator_enable(adc->vref); if (ret) -- 2.25.1