Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4474472pxb; Mon, 27 Sep 2021 18:43:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhbwclF3Vfhn3sMk723mw92jWyF5NLboIfVClaE30o9AxqvYiwG60NMuR28hKwhxvgGI94 X-Received: by 2002:a17:903:1252:b0:13d:f3f6:2e1c with SMTP id u18-20020a170903125200b0013df3f62e1cmr2680902plh.73.1632793392830; Mon, 27 Sep 2021 18:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793392; cv=none; d=google.com; s=arc-20160816; b=jM543gf7HhstnbPp1NabFvpZdmyp2FH5mNnEiXb3WisCLcsMfzCBbzuO0n0H8rJzm7 p/rFqdEKMiqLMGojgY0pp5lhV91fmIhI4TpOGDlXp/LTNAOQYlrxFS6K/GZcOOIZrimU hZ/TPBfFy4bW42xDX9cnFW47QnhrA5ZNbw1owUa7dft9LWMe/AekCH6Yw0MCfA0+tLoz lQawyt23KhSqcr2PXGkkz3YO+e+0u4EgQ3g/GrCpO13Q80eveVYbOF2fsV/O7zr57SLf ILssb4xUbZHbPwK8iLUJ/CgM+oMQoe0cCUQGhxZQ4TwFA2U6TbpKfiTsW01NHWdua8eQ NNjw== 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=drDUiJa8oh9knU2ufZ9XeXm90PXQBv/i3LGXkHIgGbsd3/4XmFT1SWBoeq01j7FcTL Vex7rPb7IjqPdxBGS+WEvWWQi36dK+KwG0iJFLUuHpWZDiCTOIkAs/ByEJnrqCgCHWpA NYGAwTv16Ytqpt7zWSoiaePWtk/gQrV6X1L/QVDmM/Hi8WlQgDlS8KyJoDZKyNW6hIlt 13c0MhKJW5QL6mF/8ZDDSxa8xUTJey4KpgVFHYKlFyErCNKxEijWYNqCaKDuhUQvGZKN Q5gjy1GmuAr3u6tuTJAmydCuo2o/uKTYfDgYJekRa2+lxdfW2XvUdrZ38kFoyGECBZjP g0jA== 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 1si1402377pju.122.2021.09.27.18.43.00; Mon, 27 Sep 2021 18:43:12 -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 S238527AbhI1Bnr (ORCPT + 99 others); Mon, 27 Sep 2021 21:43:47 -0400 Received: from mx24.baidu.com ([111.206.215.185]:50352 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238496AbhI1Bnp (ORCPT ); Mon, 27 Sep 2021 21:43:45 -0400 Received: from BC-Mail-Ex30.internal.baidu.com (unknown [172.31.51.24]) by Forcepoint Email with ESMTPS id AA57B37F630DEFD6BE22; Tue, 28 Sep 2021 09:42:05 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex30.internal.baidu.com (172.31.51.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Tue, 28 Sep 2021 09:42:05 +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; Tue, 28 Sep 2021 09:42:04 +0800 From: Cai Huoqing To: CC: Kevin Tsai , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , , Subject: [PATCH v2 1/4] iio: light: cm3605: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:41:52 +0800 Message-ID: <20210928014156.1491-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: BC-Mail-Ex31.internal.baidu.com (172.31.51.25) 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