Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp787531pxb; Wed, 29 Sep 2021 09:38:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4GXlUHv/0Ihzj9Wu5AhmgPgtci2iIuuvU8z8rRQR7mxTUEpcm5zZgenlkkFhPZLJ/O2jE X-Received: by 2002:a17:90a:4a03:: with SMTP id e3mr917135pjh.198.1632933500226; Wed, 29 Sep 2021 09:38:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632933500; cv=none; d=google.com; s=arc-20160816; b=UnPTpW8Fxrv8PGM8qrUAzApN3v8NKp9tG4fUbEojFw9KceCtx5ShGaZfsYHr8GcdwZ gs8JPGe7GmpyKOnqP6cgIIg3za0OC69JbJEOFTV75G+lMIjpMdCgpiKANzMyPPEKA882 cRhQqeP9hTOpOXatnEBnAF8ZI0ssLajUYrFr3Gb7UZ2ZeVeDqeVEihGgM84Xp2JLF8Ae jtZ4or7TnpgBkrbL3HZUDxrUvWnb5peEfXoLFTRXHaZVNGJ6LjtVmslBZFGEN1WQQxeO bMG5za9tfCSMCNr8TW0Fs6G0jJH7J1gttBLOGfnryLOL7vx64o66YcnIU5OxLpkof5Pq rBlg== 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=/n8NtVyraAvOqNXgUllwXFgmCDmdfn2y6ESPnZDfagA=; b=pPkAKI92W6dHPMbtVdtiifwiA7Vr+oFciOeUlId0wcRIo1Whg+k6aH0P3GCVmidoTY wV3Cx1a/6P2yQxL2qm8mwZN4XqGTUtz9DA0K5t57lzxkSCZ7dTvdyDcf3WJp9PRGpPyN ZXAd01PhwBKAKsu+a0quDDqfzjakHK/r4XJ0vhLp3eZ8klx1zqyAam4ylGuOBGFF3c9l /xD7uyWbH+Y1w1CXUO5jVqq+AoHJgnDo9Xg8epQDKuXnZrL3n+3HBgIFU1WsEHYG3OPn gotVSkyzzjLP5limSEuGkLFwbqj79Gh5vXxkKZ5YKV9F03ywbylpoGqWb2yenBfILWsu 5x5Q== 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 p15si485221plw.348.2021.09.29.09.38.07; Wed, 29 Sep 2021 09:38:20 -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 S1345896AbhI2QiM (ORCPT + 99 others); Wed, 29 Sep 2021 12:38:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:39208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345687AbhI2QiM (ORCPT ); Wed, 29 Sep 2021 12:38:12 -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 BFC20613D0; Wed, 29 Sep 2021 16:36:25 +0000 (UTC) Date: Wed, 29 Sep 2021 17:40:19 +0100 From: Jonathan Cameron To: Cai Huoqing Cc: Linus Walleij , Lars-Peter Clausen , Shawn Guo , Sascha Hauer , "Pengutronix Kernel Team" , Fabio Estevam , "NXP Linux Team" , Vladimir Zapolskiy , "Neil Armstrong" , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Andy Gross , "Bjorn Andersson" , Heiko Stuebner , , , , , , Subject: Re: [PATCH v3 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe() Message-ID: <20210929174019.3f93dfde@jic23-huawei> In-Reply-To: <20210928141956.2148-5-caihuoqing@baidu.com> References: <20210928141956.2148-1-caihuoqing@baidu.com> <20210928141956.2148-5-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 22:19:51 +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, Please also add a message to the devm_gpiod_get_optional() and similar handling so that we maintain information on that as well. Thanks, Jonathan > --- > drivers/iio/adc/max1241.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c > index b60f8448f21a..130ca8dc6fa0 100644 > --- a/drivers/iio/adc/max1241.c > +++ b/drivers/iio/adc/max1241.c > @@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi) > mutex_init(&adc->lock); > > adc->vdd = devm_regulator_get(dev, "vdd"); > - if (IS_ERR(adc->vdd)) { > - dev_err(dev, "failed to get vdd regulator\n"); > - return PTR_ERR(adc->vdd); > - } > + if (IS_ERR(adc->vdd)) > + return dev_err_probe(dev, PTR_ERR(adc->vdd), > + "failed to get vdd regulator\n"); > > ret = regulator_enable(adc->vdd); > if (ret) > @@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi) > } > > adc->vref = devm_regulator_get(dev, "vref"); > - if (IS_ERR(adc->vref)) { > - dev_err(dev, "failed to get vref regulator\n"); > - return PTR_ERR(adc->vref); > - } > + if (IS_ERR(adc->vref)) > + return dev_err_probe(dev, PTR_ERR(adc->vref), > + "failed to get vref regulator\n"); > > ret = regulator_enable(adc->vref); > if (ret)