Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2177134pxb; Fri, 8 Oct 2021 02:29:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBBk9lOnGK/j+UmYmEEX15Ke2zoDUHp3ek8ZtHLM5eGhdBdLZwqP8HJrbI+GGcGabxASoJ X-Received: by 2002:a17:90b:4d0b:: with SMTP id mw11mr10484067pjb.135.1633685376625; Fri, 08 Oct 2021 02:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633685376; cv=none; d=google.com; s=arc-20160816; b=oL6TYDIiDT4EireafSCTFQMbiEb8O5UxwpnB7d9joLFVZo7zlg82AjXml/lnjS7WDL tsuEnH4yJ6ZG/6v2HHh5xFVUgx2AfISR0nm+2j0kHdVMr55bfhlu5vffWlOaARWa3pY3 zYI90o7Z1on1zPu9gmOtK63b+ZmhSwc5V7+n4EpFWN6M/vD7q/AOaQsL7oAAT7dAzXDV zFbZFckfFaNdy1Ju/ylErRTt1Vb90n+42KaiOligmG1++uuFddP4JBlQrcOP4sfJQolk pvT6+pl8ATab/eur5De9DhjYc19ND4069tBuqol01ciE8YcVhkYL5YrQtDRDIlrAM+5L ogeg== 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=YlWo0qaCveuknVFv/Rvdk/8mLTIiPAAAHcpzXgNZjSQ=; b=eIwFWfEDqoSj6PTiaExgRkNS24Cna5kp6r+H+rYTFAKY4LFFseWe8zmqUnlCUjyYYk di1htRvkCw4KVOD0FbctAXFgC0AfVYADZdrLbNv8iCPynweTF6wtM08SDuIX0VunhzGw q/oNoHpDS+8+1e/hLFjYDgJ2LGlwB2nf9gpoEb7dGlDXl11BEAEIgCB6w4Z1EaGz3pWq tscMT3KKxh7O6MqMzgKQQldD5jGENxKXY/SEUMKu9O4zLovvJ7Xs3MXwZERUgHrDl61Z Q9MBXGn6dWwwv88ipNwrY5QFrQjlb+mAMhoDna1yr1mrgPEooY/QXvh9qXfIuAk6mzIj V8yw== 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 s23si680845pju.119.2021.10.08.02.29.24; Fri, 08 Oct 2021 02:29: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 S238638AbhJHJ3M (ORCPT + 99 others); Fri, 8 Oct 2021 05:29:12 -0400 Received: from mx22.baidu.com ([220.181.50.185]:35306 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238154AbhJHJ3J (ORCPT ); Fri, 8 Oct 2021 05:29:09 -0400 Received: from BJHW-Mail-Ex02.internal.baidu.com (unknown [10.127.64.12]) by Forcepoint Email with ESMTPS id 86D43B5C25AFA2FEFE3D; Fri, 8 Oct 2021 17:27:13 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex02.internal.baidu.com (10.127.64.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Fri, 8 Oct 2021 17:27:13 +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; Fri, 8 Oct 2021 17:27:12 +0800 From: Cai Huoqing To: CC: Kevin Tsai , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , , Subject: [PATCH v3 4/4] iio: light: noa1305: Make use of the helper function dev_err_probe() Date: Fri, 8 Oct 2021 17:26:55 +0800 Message-ID: <20211008092656.421-4-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211008092656.421-1-caihuoqing@baidu.com> References: <20211008092656.421-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex14.internal.baidu.com (172.31.51.54) 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(). v2 is applied to the togreg branch of iio.git drivers/iio/light/noa1305.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/noa1305.c b/drivers/iio/light/noa1305.c index a308fbc2fc7b..ee81fe083e4c 100644 --- a/drivers/iio/light/noa1305.c +++ b/drivers/iio/light/noa1305.c @@ -217,10 +217,9 @@ static int noa1305_probe(struct i2c_client *client, priv = iio_priv(indio_dev); priv->vin_reg = devm_regulator_get(&client->dev, "vin"); - if (IS_ERR(priv->vin_reg)) { - dev_err(&client->dev, "get regulator vin failed\n"); - return PTR_ERR(priv->vin_reg); - } + if (IS_ERR(priv->vin_reg)) + return dev_err_probe(&client->dev, PTR_ERR(priv->vin_reg), + "get regulator vin failed\n"); ret = regulator_enable(priv->vin_reg); if (ret) { -- 2.25.1