Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3754976pxb; Mon, 27 Sep 2021 01:36:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjcrNg7AUwN92HigraSs6Ch8YGmUJXuD7fRL5M6O+WQntu5d+aIqX052Q9ID2S5Srb3DgK X-Received: by 2002:a17:906:7c4:: with SMTP id m4mr26109490ejc.553.1632731819157; Mon, 27 Sep 2021 01:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731819; cv=none; d=google.com; s=arc-20160816; b=xkczUo/huYI8OChDZz+9G8kreskH9DX/deL/WklbpG5aj5yoeo0Er0sGoSc7esPuwQ Irvi+ANQ98gKLA36IDfrJrPBaFSw+wQrGJi7wvN3ihHBVN2LfNi2rGldrY6nMRV4B/u2 YvmX2abbqRG6ZqSMKq5XdeZrdDH2gmXf0oQcMit4OwGBCR7++vK+jSik+/Y90dNo2hro TlzkGk9qaVsaK4zLo5ASHgDsQ5L9RePwr5vbYlsoB1TJ/Rp2L2Ti23BN+gPxsTlyL9/N iaT/U57C1bY7F7ZtXiFW6j18s3tC/sm+fsox3hj1QdOFfSuCy9BfBbcscDeDsZaw9Ied 9oTQ== 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=sHtC2H8YgPn2u4EpDKTr8VBLauZne5Q/g6l5N9CSBaU=; b=q0GolEW2CIrV3K70TUILy9C0/oh7xdrMqEN4jXliaPxjjmY1A+EVx0+dFzU/aFsQP6 0OECsKYV7uN7Wjzr9nBTfOMrcowqoGVbtKW//RgJOi6BYcMlSocMh4LuJgbDrWpEDSnn 47/r11k+bt2SRVzqGxsYwSto7HkCrOki6kugbwEmJX17mOne11woeQVVjNbg2Xj25i0n Cltz0eZad5LVWA8nh3M81FY3UwFPhJyokM1S1yL0lzwGqp5T+q1/l1hgRATxRLmOmAGn 4D0OHWFLxRiAWdL2RsMWHyQlpy5prbD/2Tt+VEqRdpS8NX0VyH+Nh3hgFY9NmAinik0r Be0w== 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 x2si21797773ejy.385.2021.09.27.01.36.35; Mon, 27 Sep 2021 01:36:59 -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 S233574AbhI0Ieh (ORCPT + 99 others); Mon, 27 Sep 2021 04:34:37 -0400 Received: from mx24.baidu.com ([111.206.215.185]:39768 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233529AbhI0Ie3 (ORCPT ); Mon, 27 Sep 2021 04:34:29 -0400 Received: from BJHW-MAIL-EX04.internal.baidu.com (unknown [10.127.64.14]) by Forcepoint Email with ESMTPS id 70576373237A66F66292; Mon, 27 Sep 2021 16:32:50 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-MAIL-EX04.internal.baidu.com (10.127.64.14) 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:50 +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:49 +0800 From: Cai Huoqing To: CC: Kevin Tsai , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , , Subject: [PATCH 2/4] iio: light: cm36651: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:32:36 +0800 Message-ID: <20210927083238.949-2-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/cm36651.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index fd83a19929bc..c7cc4b0fe8b2 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c @@ -632,10 +632,10 @@ 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