Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3754252pxb; Mon, 27 Sep 2021 01:35:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7KHMumsyJUMeIqYd6IRgX23EOrUYpewBp7lIvz+7d6/zeNRm+wRc+CaI2raOu5UxO/scX X-Received: by 2002:a05:6402:493:: with SMTP id k19mr21535921edv.386.1632731739761; Mon, 27 Sep 2021 01:35:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731739; cv=none; d=google.com; s=arc-20160816; b=1G0un/huMbPYGkcCgJw9tYvqmSG8hzdkZBOoLTOtR242KZQ4irXn+0daXT64NzL1vO E0GqL+RtMwJyl3cKiLHJjyduqlyc7enk9bYGJHke6XdpizkkDgaN4DDjnO4CHP+rqOwv YdnU2gJmuhaqgQImGe2mHdarHd+DrIF15Y+UKmFzJXUXK2iiibymWtIq/rdBPviVSvgh ITqpeln7eR5AS8jD7AVmKGSI/RRlCXFdqcNVqLaeee2nRkko5mw5vGd8htlk8iNADwbJ fWVInYWtcxlCXotErlz3Gif6KjdW7nbh9n4lDPtiDLK5zahVuoQtBgfS+1AaK9rTE/M3 Oyxw== 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=rBZ81i9SiwPUK9az4WSeGrHmtqL+35AUYITQevuOZRs=; b=GGh5/BTeHLdDN1fIGnhpDX7VL6L7Or+IwMc/fRJS+UGDeGKr1HQrHmT1JW+EXG/nVP AtMumrazkTeOFP+7dgCmOwqE+4HcPEBt6DLK09BxcgGcFufoOysMMmN3lnav2iIvR/oB uXu4ZaJmL+i+kKdps1UQ2A0702peDRyt6tuCibf94G1eFkEBBU8thigpNTVTYppDU19p 4vc433UunDDqxn/MyKrZuNdfc2V+UoXsi7YMvA118ZOqG5NikgG3otMsMQWLpvtp4ohS LeA22EP3krm+o+pWbtyoYvb23ScCmvsC8HcjlCyyYuNTVzmPowqWE+PA+vJcwPRH6Eko Ay+Q== 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 6si17118438ejc.751.2021.09.27.01.35.16; Mon, 27 Sep 2021 01:35:39 -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 S233557AbhI0Ien (ORCPT + 99 others); Mon, 27 Sep 2021 04:34:43 -0400 Received: from mx24.baidu.com ([111.206.215.185]:39968 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233572AbhI0Iei (ORCPT ); Mon, 27 Sep 2021 04:34:38 -0400 Received: from BC-Mail-Ex31.internal.baidu.com (unknown [172.31.51.25]) by Forcepoint Email with ESMTPS id 6CDE08DB0AD840A98160; Mon, 27 Sep 2021 16:32:59 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex31.internal.baidu.com (172.31.51.25) 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:32:59 +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:32:58 +0800 From: Cai Huoqing To: CC: Kevin Tsai , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , , Subject: [PATCH 4/4] iio: light: noa1305: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:32:38 +0800 Message-ID: <20210927083238.949-4-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927083238.949-1-caihuoqing@baidu.com> References: <20210927083238.949-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BJHW-Mail-Ex01.internal.baidu.com (10.127.64.11) 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/light/noa1305.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/noa1305.c b/drivers/iio/light/noa1305.c index a308fbc2fc7b..71a322227429 100644 --- a/drivers/iio/light/noa1305.c +++ b/drivers/iio/light/noa1305.c @@ -217,10 +217,10 @@ 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