From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"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>,
"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, "Joe Perches" <joe@perches.com>,
"Andy Whitcroft" <apw@canonical.com>,
"Dwaipayan Ray" <dwaipayanray1@gmail.com>,
"Lukas Bulwahn" <lukas.bulwahn@gmail.com>
Subject: Re: [PATCH] Remove error prints for devm_add_action_or_reset()
Date: Wed, 2 Jul 2025 10:58:26 +0100 [thread overview]
Message-ID: <20250702105826.0000315e@huawei.com> (raw)
In-Reply-To: <jeajjewfbg5qo736imozpghnpxln2pux74aegtqsi57qsbpug2@opndel6zc3m3>
On Wed, 2 Jul 2025 08:54:48 +0200
Uwe Kleine-König <ukleinek@kernel.org> wrote:
> Hello Jonathan,
>
> On Tue, Jul 01, 2025 at 06:55:19PM +0100, Jonathan Cameron wrote:
> > On Tue, 1 Jul 2025 19:44:17 +0200
> > Uwe Kleine-König <ukleinek@kernel.org> wrote:
> >
> > > On Tue, Jul 01, 2025 at 05:03:33PM +0200, Waqar Hameed wrote:
> > > > drivers/pwm/pwm-meson.c | 3 +--
> > >
> > > Looking at this driver I tried the following:
> >
> > I'm not sure what we actually want here.
> >
> > My thought when suggesting removing instances of this
> > particular combination wasn't saving on code size, but rather just
> > general removal of pointless code that was getting cut and
> > paste into new drivers and wasting a tiny bit of review bandwidth.
> > I'd consider it bad practice to have patterns like
> >
> > void *something = kmalloc();
> > if (!something)
> > return dev_err_probe(dev, -ENOMEM, ..);
> >
> > and my assumption was people would take a similar view with
> > devm_add_action_or_reset().
> >
> > It is a bit nuanced to have some cases where we think prints
> > are reasonable and others where they aren't so I get your
> > point about consistency.
>
> The problem I see is that there are two classes of functions: a) Those
> that require an error message and b) those that don't. Class b) consists
> of the functions that can only return success or -ENOMEM and the
> functions that emit an error message themselves. (And another problem I
> see is that for the latter the error message is usually non-optimal
> because the function doesn't know the all details of the request. See my
> reply to Andy for more details about that rant.)
>
> IMHO what takes away the review bandwidth is that the reviewer has to
> check which class the failing function is part of. If this effort
> results in more driver authors not adding an error message after
> devm_add_action_or_reset() that's nice, but in two months I have
> forgotten the details of this discussion and I have to recheck if
> devm_add_action_or_reset() is part of a) or b) and so the burden is
> still on me.
Maybe this is a job for checkpatch, at least for the common cases.
There is already a check for kmalloc etc.
https://elixir.bootlin.com/linux/v6.16-rc4/source/scripts/checkpatch.pl#L6442
+CC Joe (who wrote the allocation functions test years ago) and other checkpatch
folk.
>
> So to give my answer on your question "What do we actually want here?":
> Please let us get rid of the need to care for a) or b).
>
> > The code size reduction is nice so I'd not be against it as an extra
> > if the reduction across a kernel builds is significant and enough
> > people want to keep these non printing prints.
>
> To complete implementing my wish all API functions would need to stop to
> emit an error message. Unfortunately that isn't without downsides
> because the result is that there are more error strings and so the
> kernel size is increased. So you have to weight if you prefer individual
> error messages and easier review/maintenance at the cost of a bigger
> binary size and more dev_err_probe() calls in drivers eating vertical
> space in your editor.
>
> I know on which side I am, but I bet we won't find agreement about that
> in the kernel community ...
>
> Best regards
> Uwe
>
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"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>,
"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, "Joe Perches" <joe@perches.com>,
"Andy Whitcroft" <apw@canonical.com>,
"Dwaipayan Ray" <dwaipayanray1@gmail.com>,
"Lukas Bulwahn" <lukas.bulwahn@gmail.com>
Subject: Re: [PATCH] Remove error prints for devm_add_action_or_reset()
Date: Wed, 2 Jul 2025 10:58:26 +0100 [thread overview]
Message-ID: <20250702105826.0000315e@huawei.com> (raw)
In-Reply-To: <jeajjewfbg5qo736imozpghnpxln2pux74aegtqsi57qsbpug2@opndel6zc3m3>
On Wed, 2 Jul 2025 08:54:48 +0200
Uwe Kleine-König <ukleinek@kernel.org> wrote:
> Hello Jonathan,
>
> On Tue, Jul 01, 2025 at 06:55:19PM +0100, Jonathan Cameron wrote:
> > On Tue, 1 Jul 2025 19:44:17 +0200
> > Uwe Kleine-König <ukleinek@kernel.org> wrote:
> >
> > > On Tue, Jul 01, 2025 at 05:03:33PM +0200, Waqar Hameed wrote:
> > > > drivers/pwm/pwm-meson.c | 3 +--
> > >
> > > Looking at this driver I tried the following:
> >
> > I'm not sure what we actually want here.
> >
> > My thought when suggesting removing instances of this
> > particular combination wasn't saving on code size, but rather just
> > general removal of pointless code that was getting cut and
> > paste into new drivers and wasting a tiny bit of review bandwidth.
> > I'd consider it bad practice to have patterns like
> >
> > void *something = kmalloc();
> > if (!something)
> > return dev_err_probe(dev, -ENOMEM, ..);
> >
> > and my assumption was people would take a similar view with
> > devm_add_action_or_reset().
> >
> > It is a bit nuanced to have some cases where we think prints
> > are reasonable and others where they aren't so I get your
> > point about consistency.
>
> The problem I see is that there are two classes of functions: a) Those
> that require an error message and b) those that don't. Class b) consists
> of the functions that can only return success or -ENOMEM and the
> functions that emit an error message themselves. (And another problem I
> see is that for the latter the error message is usually non-optimal
> because the function doesn't know the all details of the request. See my
> reply to Andy for more details about that rant.)
>
> IMHO what takes away the review bandwidth is that the reviewer has to
> check which class the failing function is part of. If this effort
> results in more driver authors not adding an error message after
> devm_add_action_or_reset() that's nice, but in two months I have
> forgotten the details of this discussion and I have to recheck if
> devm_add_action_or_reset() is part of a) or b) and so the burden is
> still on me.
Maybe this is a job for checkpatch, at least for the common cases.
There is already a check for kmalloc etc.
https://elixir.bootlin.com/linux/v6.16-rc4/source/scripts/checkpatch.pl#L6442
+CC Joe (who wrote the allocation functions test years ago) and other checkpatch
folk.
>
> So to give my answer on your question "What do we actually want here?":
> Please let us get rid of the need to care for a) or b).
>
> > The code size reduction is nice so I'd not be against it as an extra
> > if the reduction across a kernel builds is significant and enough
> > people want to keep these non printing prints.
>
> To complete implementing my wish all API functions would need to stop to
> emit an error message. Unfortunately that isn't without downsides
> because the result is that there are more error strings and so the
> kernel size is increased. So you have to weight if you prefer individual
> error messages and easier review/maintenance at the cost of a bigger
> binary size and more dev_err_probe() calls in drivers eating vertical
> space in your editor.
>
> I know on which side I am, but I bet we won't find agreement about that
> in the kernel community ...
>
> Best regards
> Uwe
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"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>,
"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, "Joe Perches" <joe@perches.com>,
"Andy Whitcroft" <apw@canonical.com>,
"Dwaipayan Ray" <dwaipayanray1@gmail.com>,
"Lukas Bulwahn" <lukas.bulwahn@gmail.com>
Subject: Re: [PATCH] Remove error prints for devm_add_action_or_reset()
Date: Wed, 2 Jul 2025 10:58:26 +0100 [thread overview]
Message-ID: <20250702105826.0000315e@huawei.com> (raw)
In-Reply-To: <jeajjewfbg5qo736imozpghnpxln2pux74aegtqsi57qsbpug2@opndel6zc3m3>
On Wed, 2 Jul 2025 08:54:48 +0200
Uwe Kleine-König <ukleinek@kernel.org> wrote:
> Hello Jonathan,
>
> On Tue, Jul 01, 2025 at 06:55:19PM +0100, Jonathan Cameron wrote:
> > On Tue, 1 Jul 2025 19:44:17 +0200
> > Uwe Kleine-König <ukleinek@kernel.org> wrote:
> >
> > > On Tue, Jul 01, 2025 at 05:03:33PM +0200, Waqar Hameed wrote:
> > > > drivers/pwm/pwm-meson.c | 3 +--
> > >
> > > Looking at this driver I tried the following:
> >
> > I'm not sure what we actually want here.
> >
> > My thought when suggesting removing instances of this
> > particular combination wasn't saving on code size, but rather just
> > general removal of pointless code that was getting cut and
> > paste into new drivers and wasting a tiny bit of review bandwidth.
> > I'd consider it bad practice to have patterns like
> >
> > void *something = kmalloc();
> > if (!something)
> > return dev_err_probe(dev, -ENOMEM, ..);
> >
> > and my assumption was people would take a similar view with
> > devm_add_action_or_reset().
> >
> > It is a bit nuanced to have some cases where we think prints
> > are reasonable and others where they aren't so I get your
> > point about consistency.
>
> The problem I see is that there are two classes of functions: a) Those
> that require an error message and b) those that don't. Class b) consists
> of the functions that can only return success or -ENOMEM and the
> functions that emit an error message themselves. (And another problem I
> see is that for the latter the error message is usually non-optimal
> because the function doesn't know the all details of the request. See my
> reply to Andy for more details about that rant.)
>
> IMHO what takes away the review bandwidth is that the reviewer has to
> check which class the failing function is part of. If this effort
> results in more driver authors not adding an error message after
> devm_add_action_or_reset() that's nice, but in two months I have
> forgotten the details of this discussion and I have to recheck if
> devm_add_action_or_reset() is part of a) or b) and so the burden is
> still on me.
Maybe this is a job for checkpatch, at least for the common cases.
There is already a check for kmalloc etc.
https://elixir.bootlin.com/linux/v6.16-rc4/source/scripts/checkpatch.pl#L6442
+CC Joe (who wrote the allocation functions test years ago) and other checkpatch
folk.
>
> So to give my answer on your question "What do we actually want here?":
> Please let us get rid of the need to care for a) or b).
>
> > The code size reduction is nice so I'd not be against it as an extra
> > if the reduction across a kernel builds is significant and enough
> > people want to keep these non printing prints.
>
> To complete implementing my wish all API functions would need to stop to
> emit an error message. Unfortunately that isn't without downsides
> because the result is that there are more error strings and so the
> kernel size is increased. So you have to weight if you prefer individual
> error messages and easier review/maintenance at the cost of a bigger
> binary size and more dev_err_probe() calls in drivers eating vertical
> space in your editor.
>
> I know on which side I am, but I bet we won't find agreement about that
> in the kernel community ...
>
> Best regards
> Uwe
>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2025-07-02 9:58 UTC|newest]
Thread overview: 51+ 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:03 ` Waqar Hameed
2025-07-01 15:03 ` Waqar Hameed
2025-07-01 15:03 ` Waqar Hameed
2025-07-01 15:16 ` David Lechner
2025-07-01 15:16 ` David Lechner
2025-07-01 15:16 ` David Lechner
2025-07-01 15:16 ` David Lechner
2025-07-01 16:14 ` Waqar Hameed
2025-07-01 16:14 ` Waqar Hameed
2025-07-01 16:14 ` Waqar Hameed
2025-07-01 16:14 ` Waqar Hameed
2025-07-01 15:25 ` Geraldo Nascimento
2025-07-01 15:25 ` Geraldo Nascimento
2025-07-01 15:25 ` Geraldo Nascimento
2025-07-01 15:25 ` Geraldo Nascimento
2025-07-01 16:15 ` Waqar Hameed
2025-07-01 16:15 ` Waqar Hameed
2025-07-01 16:15 ` Waqar Hameed
2025-07-01 16:15 ` Waqar Hameed
2025-07-01 16:25 ` Geraldo Nascimento
2025-07-01 16:25 ` Geraldo Nascimento
2025-07-01 16:25 ` Geraldo Nascimento
2025-07-01 16:25 ` Geraldo Nascimento
2025-07-01 17:44 ` Uwe Kleine-König
2025-07-01 17:44 ` Uwe Kleine-König
2025-07-01 17:44 ` Uwe Kleine-König
2025-07-01 17:44 ` Uwe Kleine-König
2025-07-01 17:55 ` Jonathan Cameron
2025-07-01 17:55 ` Jonathan Cameron
2025-07-01 17:55 ` Jonathan Cameron
2025-07-01 17:55 ` Jonathan Cameron
2025-07-02 6:54 ` Uwe Kleine-König
2025-07-02 6:54 ` Uwe Kleine-König
2025-07-02 6:54 ` Uwe Kleine-König
2025-07-02 6:54 ` Uwe Kleine-König
2025-07-02 9:58 ` Jonathan Cameron [this message]
2025-07-02 9:58 ` Jonathan Cameron
2025-07-02 9:58 ` Jonathan Cameron
2025-07-01 17:57 ` Andy Shevchenko
2025-07-01 17:57 ` Andy Shevchenko
2025-07-01 17:57 ` Andy Shevchenko
2025-07-01 17:57 ` Andy Shevchenko
2025-07-02 6:10 ` Uwe Kleine-König
2025-07-02 6:10 ` Uwe Kleine-König
2025-07-02 6:10 ` Uwe Kleine-König
2025-07-02 6:10 ` Uwe Kleine-König
2025-07-02 7:53 ` Andy Shevchenko
2025-07-02 7:53 ` Andy Shevchenko
2025-07-02 7:53 ` Andy Shevchenko
2025-07-02 7:53 ` Andy Shevchenko
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=20250702105826.0000315e@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=Michael.Hennerich@analog.com \
--cc=alim.akhtar@samsung.com \
--cc=andrew+netdev@lunn.ch \
--cc=andy@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=apw@canonical.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=dwaipayanray1@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=joe@perches.com \
--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=lukas.bulwahn@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.