Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1573797pxb; Thu, 7 Oct 2021 10:26:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF6v41PkYjXp76QGmAQDkG0gNvY7zW7jb6PduWaFh9a5KHNoImh7HVjB7zHlGqoVoxPnYG X-Received: by 2002:a17:906:39cb:: with SMTP id i11mr7706365eje.168.1633627576850; Thu, 07 Oct 2021 10:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633627576; cv=none; d=google.com; s=arc-20160816; b=ey6xoLwsYdfQIA1GdXOccdSHlstu9v+tDSBlJQI0wYBGT+DiVB9F9o4XDmN8zjYB/K XG10ytx/t4FX39PxrNQbY/kOI7FYmMrZLahMUPrVcpS6zaSAEAEaDZjIKz1Qvj5bWNZU 0mEkWBMSua3LfsbUPuOD/lBz5uFh1ZeZ1buE8FjbCuwxsyRis0p434yorRYoPURChlhD 8OdTT023qm4s+AqMEr/enBvUBtjEajILYvhxn6XNcsCisV+Zf0F1AVcXaTndjjwPP2QV G8URGXGYmbJvx4rGa3bCyszLAUltUC38HpDoDZfoWB+TqGE27HnYwutTNZaQqATBtfIb 8rlA== 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=tmcuHDpUrfOylfo6GsBb5eRKdlwIMrmpFfzblakiO5I=; b=paHAmKY7MH7mAofrw71AKj44+AV2QHLwyvz8RrOgw4sgOXQAiN/dwu5CeqodY+5CSz W2gWO3sMdxuYvBHJbRSwldZmVuHtAfOlwtyWaTtrVwhaKEs98JI80a25rVlDU7iBDkck mkcVjzQ55BaFmrJL2RSMNpuYMgHGdI+7RuYRMU3mU0Yf3W1swb19bigItbj6USPPfmnl P3cUf/qN6JTTaoHMeDrDU2kanAe60782sx5szoA/ySeYVTLkdjo+QvE8BfsqzydzYqvj dfosMRywiTy8aRBkw/5sUrvKkNjSTgONZCJavSS0xNPSH4Yl6sbxZb14xSh5wbLPEFfX XLJQ== 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 d4si110206edm.247.2021.10.07.10.25.53; Thu, 07 Oct 2021 10:26:16 -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 S240692AbhJGR0G (ORCPT + 99 others); Thu, 7 Oct 2021 13:26:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:52494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233431AbhJGR0C (ORCPT ); Thu, 7 Oct 2021 13:26:02 -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 10CD36113E; Thu, 7 Oct 2021 17:24:06 +0000 (UTC) Date: Thu, 7 Oct 2021 18:28:10 +0100 From: Jonathan Cameron To: Cai Huoqing Cc: Lars-Peter Clausen , , , Denis CIOCCA Subject: Re: [PATCH v2 1/2] iio: st_sensors: Make use of the helper function dev_err_probe() Message-ID: <20211007182810.245d5502@jic23-huawei> In-Reply-To: <20210928014055.1431-1-caihuoqing@baidu.com> References: <20210928014055.1431-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:40:53 +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 +CC Denis though this looks simple enough I'll take it now. Applied to the togreg branch of iio.git and pushed out as testing for all the normal reasons. Thanks, Jonathan > --- > v1->v2: Remove the separate line of PTR_ERR(). > > .../iio/common/st_sensors/st_sensors_core.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c > index a5a140de9a23..732d0f8f99f6 100644 > --- a/drivers/iio/common/st_sensors/st_sensors_core.c > +++ b/drivers/iio/common/st_sensors/st_sensors_core.c > @@ -228,10 +228,10 @@ int st_sensors_power_enable(struct iio_dev *indio_dev) > > /* Regulators not mandatory, but if requested we should enable them. */ > pdata->vdd = devm_regulator_get(parent, "vdd"); > - if (IS_ERR(pdata->vdd)) { > - dev_err(&indio_dev->dev, "unable to get Vdd supply\n"); > - return PTR_ERR(pdata->vdd); > - } > + if (IS_ERR(pdata->vdd)) > + return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd), > + "unable to get Vdd supply\n"); > + > err = regulator_enable(pdata->vdd); > if (err != 0) { > dev_warn(&indio_dev->dev, > @@ -243,10 +245,10 @@ int st_sensors_power_enable(struct iio_dev *indio_dev) > return err; > > pdata->vdd_io = devm_regulator_get(parent, "vddio"); > - if (IS_ERR(pdata->vdd_io)) { > - dev_err(&indio_dev->dev, "unable to get Vdd_IO supply\n"); > - return PTR_ERR(pdata->vdd_io); > - } > + if (IS_ERR(pdata->vdd_io)) > + return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd_io), > + "unable to get Vdd_IO supply\n"); > + > err = regulator_enable(pdata->vdd_io); > if (err != 0) { > dev_warn(&indio_dev->dev,