Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2176715pxb; Fri, 8 Oct 2021 02:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzubQkPzqazY32JooI3DzyHxzbcyb4VD2OBRBE5h130Tq0h9szMKcNHI4eNbg0VA+ugY1fX X-Received: by 2002:a05:6402:4402:: with SMTP id y2mr4880831eda.222.1633685337356; Fri, 08 Oct 2021 02:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633685337; cv=none; d=google.com; s=arc-20160816; b=w1nSFQX1DecucZtU+k0MvRWRZ33l4/JU/bPJroqSNvzqJILDxhmdR/Su6bpUMIvxp9 Ikvnb9euO144Hg+lG0JJ5dK701LBO67mFiQ3W1fNOzvZ/dmuJJqLOwQ5fuppsEQiHF14 hyqOhSZ//JU9e6Qv+GtQ9rtbwQv+AmkpmQpB9henMOWgQjvsL79OdIU6orKv4JtnAiiF z6T0d5xPyc2ikrTHZGuVBIjcl7AAVombQ995G8PSGiN2g44hkdOfA3qBzMezfr2E5Ggp Yrvm0FvBvol4/Fj2F9gfsNtPuAyPddbJWsQFEklcWE7oWA15ZuGPwRRdMvYhSwRMSx4p 8rsA== 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=1WzAdrqSZE8FpHhUOWJPBISaEgP93pnqIodPLroEtz4=; b=Rfjx8phsW+tF7nNgBhiyy3eTss1VVRc73WkidzMf2flTUrA5N4uCbO+iRZYniLMAOv 9z7NNvPabLw2sahsiEnnMv9XmTdVCigfyPDymoignG0Aea9ZD7pUlLQr4Bw+sLJcLVeS 8LsqaafAGiXWHB7UfctSNQJkU04M7rA4fI5ZRDIEMeJ0DvCb1qaxtjrgp7VKFkWihVkb GbAWSt9Sqc4H83N3a5Jpk1thzbtwJzxTqAHJBOPBBebJ69xNPWZIEuJ4mCCpvsFeyRyI JhkLvvW0UDuIo/PFtggH2UN39aknyQgRm5cLT2vuWTFfWcuVbQWcpnIncjcsWmCYCihe fXyg== 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 n2si2852849edi.258.2021.10.08.02.28.33; Fri, 08 Oct 2021 02:28:57 -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 S238321AbhJHJ3C (ORCPT + 99 others); Fri, 8 Oct 2021 05:29:02 -0400 Received: from mx24.baidu.com ([111.206.215.185]:35010 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238236AbhJHJ26 (ORCPT ); Fri, 8 Oct 2021 05:28:58 -0400 Received: from BJHW-Mail-Ex05.internal.baidu.com (unknown [10.127.64.15]) by Forcepoint Email with ESMTPS id C38C3F4D9EDB4F80D385; Fri, 8 Oct 2021 17:26:59 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex05.internal.baidu.com (10.127.64.15) 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:26: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; Fri, 8 Oct 2021 17:26:59 +0800 From: Cai Huoqing To: CC: Kevin Tsai , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , , Subject: [PATCH v3 2/4] iio: light: cm36651: Make use of the helper function dev_err_probe() Date: Fri, 8 Oct 2021 17:26:53 +0800 Message-ID: <20211008092656.421-2-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) X-Baidu-BdMsfe-DateCheck: 1_BJHW-Mail-Ex05_2021-10-08 17:26:59:809 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/cm36651.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index fd83a19929bc..89f5e48a6642 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c @@ -632,10 +632,9 @@ static int cm36651_probe(struct i2c_client *client, cm36651 = iio_priv(indio_dev); cm36651->vled_reg = devm_regulator_get(&client->dev, "vled"); - if (IS_ERR(cm36651->vled_reg)) { - dev_err(&client->dev, "get regulator vled failed\n"); - return PTR_ERR(cm36651->vled_reg); - } + if (IS_ERR(cm36651->vled_reg)) + return dev_err_probe(&client->dev, PTR_ERR(cm36651->vled_reg), + "get regulator vled failed\n"); ret = regulator_enable(cm36651->vled_reg); if (ret) { -- 2.25.1