Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp827802pxb; Wed, 29 Sep 2021 10:28:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ77Gw14isXR+YJuDOtyJDhuU9ekjz3PpjuZXbRiXEd4vKVtb4W5LL5CwspERsflT8lnOA X-Received: by 2002:a50:fa93:: with SMTP id w19mr1265605edr.365.1632936486018; Wed, 29 Sep 2021 10:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632936486; cv=none; d=google.com; s=arc-20160816; b=yeJcYbYNMSDPvltC790GpC0BYBjNHuv6ssBbKh/22oBopZpuPlrSUjG+FlRFeWY5z3 W3b2/ed4LSpaOoAaYPPaBHVUbvF6WZbHxrxkH35zlM8DtTdh1Z3D612jHgIht2lE7nt7 yzH1h85PRHOcCLutgW79tOAK5W+CUcHzKGsbFWteQFAw81pfVh9Lcm2P86lpjYCKCmtN 9Y33CwoHebzabmFf0UDAG8a08XBm+/1n6PUp00h/cP/g5f3aZtvxEZ6Wl01My01uNlkH pcWJipoYfx1fTjUkXel0HLc8MIPsZ35j8NNYbTOXx/SUelEqPUr/yP4tezrYLlurMpBx YH6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=/X0lwr2HuQuXmSyvZ1gChspt1US7NdqTe/9dqH2sRMM=; b=eciTryAsWy0BYiAXaqfLs9rY8tJsIxpdbeZ5EyJTYandndRLK/71ERMmAQq3QHdajQ hQGlQUU9yPyReyRsdUwCZvdJ7k6CYTM0hY17kYGuKQjVtt4hxnqzRka7LSyd3cAWpxLO X1QY+4B8w5TT9jAYXrLy/hF+4osqgIw7ZJoClcZc5x2eTXkufJ9bLn9jP9Za/yb/UGBE ZxqpIVnm6QXRuiWIFYfRW6vsegZFpxEre3dPJbJE3rNNvC+OBEheNaIUgKreeZEtu5ZD /WoOnmTnXLE6emOF/J2qS3X2IRl8ewQadpqh8hHilSmmdTHE0Ua6wPHywtugbkHAYWrw 6WwQ== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si537179ejl.110.2021.09.29.10.27.39; Wed, 29 Sep 2021 10:28:06 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245727AbhI2P6Z (ORCPT + 99 others); Wed, 29 Sep 2021 11:58:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:48726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244682AbhI2P6Y (ORCPT ); Wed, 29 Sep 2021 11:58:24 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A57E860EE2; Wed, 29 Sep 2021 15:56:41 +0000 (UTC) Date: Wed, 29 Sep 2021 17:00:35 +0100 From: Jonathan Cameron To: Cai Huoqing Cc: Kevin Tsai , Lars-Peter Clausen , Linus Walleij , , Subject: Re: [PATCH v2 1/4] iio: light: cm3605: Make use of the helper function dev_err_probe() Message-ID: <20210929170035.619212d4@jic23-huawei> In-Reply-To: <20210928014156.1491-1-caihuoqing@baidu.com> References: <20210928014156.1491-1-caihuoqing@baidu.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 Sep 2021 09:41:52 +0800 Cai Huoqing wrote: > 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 Hi Cai, This driver has some more cases where we should potentially do something like this. It handles the lack of availability of an IIO channel in line 199 by converting an -ENODEV to an -EPROBE_DEFER. Also platform_get_irq() can return -EPROBE_DEFER and the driver isn't currently handling that properly. Both changes are of a more involved nature than the simple conversions you have here though, so perhaps a follow up patch? The parts you here look good to me. Thanks, Jonathan > --- > 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; > } >