Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3753677pxb; Mon, 27 Sep 2021 01:34:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0wh0a7uXY4JHNLd8NRgwX6m1cRoTjWm9QrIDkhvu8LLHkJugoLWsZpWF6lRGGFVb6oBXd X-Received: by 2002:aa7:cd57:: with SMTP id v23mr4004982edw.177.1632731678243; Mon, 27 Sep 2021 01:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731678; cv=none; d=google.com; s=arc-20160816; b=D1y+2QWR9ab71P2blnoRi0NLLpy6kXILLbqAEKtTd9rjnGou39NxBb+3PMSpooEPua HsJVBAxTcOOUkZMbpxFwUVrCaG+qaAHPZ9IBMy47ga7OBpIbtsYD+dcAfFIlO+TuuDrm DeDN6f7T94sEZqjbLX/NwUtXZe2Lur1Fiw77/dvVZ0ciZx600EkCdov2xn3o4wzfPWIL allsWNP51DqRrrAyrDRtBF1fAabfNZfCOrG0c1u+I5imY1KobJ7GlAfF9m8w4frnIpsT AKRz+a6QH2c9jUSY60f86HVBWf8knOaqIP72P016rf/tJQgDo2PgpPnVRUTI/NsyC6Mi MfYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=eSkxGl69bHmtRhIjX92YgWrwaetvYDeCW7Q9XtKZ03k=; b=xgZ+duvtpbcrkeXNreUAy033QBuH8jwtzXqMEIGm7hRfyFLw59R5CIZT4itQ7foRFa lMAvmmkEIiWdjtQFeHuNBdsLuIPM9bRXQf67R1Os1kzLRwQiJ3RFYtjE6W0hS2omy6aN G6XLpEsTw5rGk74Uo6GkFBhT+x2s1FSiKYw25gCfjm8S64Y8CYE+OslYU6+vFt2btkBt mfzAVxtH1Y7cNPhQe55fgmWw2ge9CIc2OjcNWwC3JS4DKTa7pCzVUx4HdZgtmAKqP22u NsA88oITi4MMoyhbQQw5cAdvBz9d3fzP/Nct0RxKUbd9Acte/BZ4nMJvRYbxGJNnrwgF r6Xw== 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 dz15si20443505edb.601.2021.09.27.01.34.14; Mon, 27 Sep 2021 01:34:38 -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 S233524AbhI0Ie1 (ORCPT + 99 others); Mon, 27 Sep 2021 04:34:27 -0400 Received: from mx22.baidu.com ([220.181.50.185]:39682 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233417AbhI0Ie0 (ORCPT ); Mon, 27 Sep 2021 04:34:26 -0400 Received: from BC-Mail-EX04.internal.baidu.com (unknown [172.31.51.44]) by Forcepoint Email with ESMTPS id B85041FB9F94DBD29FD4; Mon, 27 Sep 2021 16:32:47 +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:32:47 +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:47 +0800 From: Cai Huoqing To: CC: Kevin Tsai , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , , Subject: [PATCH 1/4] iio: light: cm3605: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:32:35 +0800 Message-ID: <20210927083238.949-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 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/cm3605.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c index 4c83953672be..0b90564213e8 100644 --- a/drivers/iio/light/cm3605.c +++ b/drivers/iio/light/cm3605.c @@ -211,10 +211,10 @@ static int cm3605_probe(struct platform_device *pdev) } cm3605->vdd = devm_regulator_get(dev, "vdd"); - if (IS_ERR(cm3605->vdd)) { - dev_err(dev, "failed to get VDD regulator\n"); - return PTR_ERR(cm3605->vdd); - } + if (IS_ERR(cm3605->vdd)) + return dev_err_probe(dev, PTR_ERR(cm3605->vdd), + "failed to get VDD regulator\n"); + ret = regulator_enable(cm3605->vdd); if (ret) { dev_err(dev, "failed to enable VDD regulator\n"); @@ -223,8 +223,7 @@ static int cm3605_probe(struct platform_device *pdev) cm3605->aset = devm_gpiod_get(dev, "aset", GPIOD_OUT_HIGH); if (IS_ERR(cm3605->aset)) { - dev_err(dev, "no ASET GPIO\n"); - ret = PTR_ERR(cm3605->aset); + ret = dev_err_probe(dev, PTR_ERR(cm3605->aset), "no ASET GPIO\n"); goto out_disable_vdd; } -- 2.25.1