public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Waqar Hameed" <waqar.hameed@axis.com>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Julien Panis" <jpanis@baylibre.com>,
	"William Breathitt Gray" <wbg@kernel.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Peter Rosin" <peda@axentia.se>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Cosmin Tanislav" <cosmin.tanislav@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Matteo Martelli" <matteomartelli3@gmail.com>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Francesco Dolcini" <francesco@dolcini.it>,
	"João Paulo Gonçalves" <jpaulo.silvagoncalves@gmail.com>,
	"Hugo Villeneuve" <hvilleneuve@dimonoff.com>,
	"Subhajit Ghosh" <subhajit.ghosh@tweaklogic.com>,
	"Mudit Sharma" <muditsharma.info@gmail.com>,
	"Gerald Loacker" <gerald.loacker@wolfvision.net>,
	"Song Qiang" <songqiang1304521@gmail.com>,
	"Crt Mori" <cmo@melexis.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Karol Gugala" <kgugala@antmicro.com>,
	"Mateusz Holenko" <mholenko@antmicro.com>,
	"Gabriel Somlo" <gsomlo@gmail.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Claudiu Manoil" <claudiu.manoil@nxp.com>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Wei Fang" <wei.fang@nxp.com>,
	"Clark Wang" <xiaoning.wang@nxp.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Alim Akhtar" <alim.akhtar@samsung.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
	"Han Xu" <han.xu@nxp.com>, "Haibo Chen" <haibo.chen@nxp.com>,
	"Yogesh Gaur" <yogeshgaur.83@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Avri Altman" <avri.altman@wdc.com>,
	"Bart Van Assche" <bvanassche@acm.org>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Souradeep Chowdhury" <quic_schowdhu@quicinc.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	"Daniel Baluta" <daniel.baluta@nxp.com>,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.dev>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	kernel@axis.com, linux-iio@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-input@vger.kernel.org,
	linux-mmc@vger.kernel.org, imx@lists.linux.dev,
	netdev@vger.kernel.org, linux-phy@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-spi@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
	sound-open-firmware@alsa-project.org,
	linux-sound@vger.kernel.org
Subject: Re: [PATCH] Remove error prints for devm_add_action_or_reset()
Date: Wed, 2 Jul 2025 10:53:50 +0300	[thread overview]
Message-ID: <aGTljgePpiPJq2xj@smile.fi.intel.com> (raw)
In-Reply-To: <zxtyk4vly2salnoy3lng2ni7pzu3wg6qnmucadnclfigrd2m2m@i6xcrmvh34r5>

On Wed, Jul 02, 2025 at 08:10:28AM +0200, Uwe Kleine-König wrote:
> On Tue, Jul 01, 2025 at 08:57:02PM +0300, Andy Shevchenko wrote:
> > On Tue, Jul 1, 2025 at 8:44 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
> > > On Tue, Jul 01, 2025 at 05:03:33PM +0200, Waqar Hameed wrote:

...

> > > With that
> > >
> > >         ret = devm_add_action_or_reset(dev, meson_pwm_s4_put_clk,
> > >                                        meson->channels[i].clk);
> > >         if (ret)
> > >                 return dev_err_probe(dev, ret,
> > >                                      "Failed to add clk_put action\n");
> > >
> > > from drivers/pwm/pwm-meson.c is optimized to
> > >
> > >         ret = devm_add_action_or_reset(dev, meson_pwm_s4_put_clk,
> > >                                        meson->channels[i].clk);
> > >         if (ret)
> > >                 return ret;
> > >
> > > .
> > >
> > > I would prefer this approach, because a) there is no need to drop all
> > > dev_err_probe()s after devm_add_action_or_reset() and b) the
> > > dev_err_probe()s could stay for consistency in the error paths of a
> > > driver.
> > 
> > Why do we need a dev_err_probe() after devm_add_action*()? I would
> > expect that the original call (if needed) can spit out a message.
> 
> I'm not a big fan of API functions that emit an error message.

We do have that in devm_ioremap*() family. Just saying...

> In general the caller knows better what went wrong (here:
> devm_add_action_or_reset() doesn't know this to be about the clk_put
> action), so the error message can be more expressive.

I'm not sure I was clear about my suggestion. What I argued is something like
this

devm_foo_alloc()
{
	ret = foo_alloc();
	if (ret)
		return dev_err_probe();

	return devm_add_action_or_reset();
}

foo_alloc() in my example is left untouched.

> Also in general an API function doesn't know if a failure is fatal or if
> the consumer handles the failure just well and if the call is part of a
> driver's .probe() so it's unclear if dev_err_probe() can/should be used.
> (I admit that the last two probably don't apply to
> devm_add_action_or_reset() but that's not a good enough reason to
> make this function special. Every special case is a maintanance burden.)

devm_*() are only supposed to be called in the probe phase. So using
dev_err_probe() there (implementations) is natural thing to do, if required.
And see above, we have such cases already.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2025-07-02  7:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01 15:03 [PATCH] Remove error prints for devm_add_action_or_reset() Waqar Hameed
2025-07-01 15:16 ` David Lechner
2025-07-01 16:14   ` Waqar Hameed
2025-07-01 15:25 ` Geraldo Nascimento
2025-07-01 16:15   ` Waqar Hameed
2025-07-01 16:25     ` Geraldo Nascimento
2025-07-01 17:44 ` Uwe Kleine-König
2025-07-01 17:55   ` Jonathan Cameron
2025-07-02  6:54     ` Uwe Kleine-König
2025-07-02  9:58       ` Jonathan Cameron
2025-07-01 17:57   ` Andy Shevchenko
2025-07-02  6:10     ` Uwe Kleine-König
2025-07-02  7:53       ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aGTljgePpiPJq2xj@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=avri.altman@wdc.com \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=claudiu.manoil@nxp.com \
    --cc=cmo@melexis.com \
    --cc=cosmin.tanislav@analog.com \
    --cc=daniel.baluta@nxp.com \
    --cc=davem@davemloft.net \
    --cc=dlechner@baylibre.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=edumazet@google.com \
    --cc=festevam@gmail.com \
    --cc=francesco@dolcini.it \
    --cc=gerald.loacker@wolfvision.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=gsomlo@gmail.com \
    --cc=haibo.chen@nxp.com \
    --cc=han.xu@nxp.com \
    --cc=heiko@sntech.de \
    --cc=hvilleneuve@dimonoff.com \
    --cc=imx@lists.linux.dev \
    --cc=jbrunet@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=joel@jms.id.au \
    --cc=jpanis@baylibre.com \
    --cc=jpaulo.silvagoncalves@gmail.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=kernel@axis.com \
    --cc=kernel@pengutronix.de \
    --cc=kgugala@antmicro.com \
    --cc=khilman@baylibre.com \
    --cc=kishon@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=martin.petersen@oracle.com \
    --cc=matteomartelli3@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mholenko@antmicro.com \
    --cc=muditsharma.info@gmail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=pabeni@redhat.com \
    --cc=peda@axentia.se \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=quic_schowdhu@quicinc.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=songqiang1304521@gmail.com \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=sre@kernel.org \
    --cc=subhajit.ghosh@tweaklogic.com \
    --cc=tiwai@suse.com \
    --cc=ukleinek@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=vigneshr@ti.com \
    --cc=vkoul@kernel.org \
    --cc=vladimir.oltean@nxp.com \
    --cc=waqar.hameed@axis.com \
    --cc=wbg@kernel.org \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    --cc=yogeshgaur.83@gmail.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox