* [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe()
@ 2025-08-19 11:26 Xichao Zhao
2025-08-20 7:04 ` Daniel Baluta
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Xichao Zhao @ 2025-08-19 11:26 UTC (permalink / raw)
To: lgirdwood, peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, broonie, perex, tiwai, shawnguo, s.hauer
Cc: kai.vehmanen, pierre-louis.bossart, kernel, festevam, linux-sound,
imx, linux-kernel, Xichao Zhao
The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
Therefore, remove the useless call to dev_err_probe(), and just
return the value instead.
Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
sound/soc/sof/imx/imx-common.c | 4 ++--
sound/soc/sof/imx/imx8.c | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/sof/imx/imx-common.c b/sound/soc/sof/imx/imx-common.c
index f00b381cec3b..4523621cda10 100644
--- a/sound/soc/sof/imx/imx-common.c
+++ b/sound/soc/sof/imx/imx-common.c
@@ -354,8 +354,8 @@ static int imx_probe(struct snd_sof_dev *sdev)
common = devm_kzalloc(sdev->dev, sizeof(*common), GFP_KERNEL);
if (!common)
- return dev_err_probe(sdev->dev, -ENOMEM,
- "failed to allocate common data\n");
+ return -ENOMEM;
+
sdev->pdata->hw_pdata = common;
common->ipc_dev = platform_device_register_data(sdev->dev, "imx-dsp",
diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index b73dd91bd529..7e9eab2e3034 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -171,8 +171,7 @@ static int imx8m_probe(struct snd_sof_dev *sdev)
chip = devm_kzalloc(sdev->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
- return dev_err_probe(sdev->dev, -ENOMEM,
- "failed to allocate chip data\n");
+ return -ENOMEM;
chip->dap = devm_ioremap(sdev->dev, IMX8M_DAP_DEBUG, IMX8M_DAP_DEBUG_SIZE);
if (!chip->dap)
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe()
2025-08-19 11:26 [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe() Xichao Zhao
@ 2025-08-20 7:04 ` Daniel Baluta
2025-08-20 9:24 ` Laurentiu Mihalcea
2025-08-20 9:29 ` Laurentiu Mihalcea
2025-08-25 20:04 ` Mark Brown
2 siblings, 1 reply; 6+ messages in thread
From: Daniel Baluta @ 2025-08-20 7:04 UTC (permalink / raw)
To: Xichao Zhao, Laurentiu Mihalcea
Cc: lgirdwood, peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, broonie, perex, tiwai, shawnguo, s.hauer,
kai.vehmanen, pierre-louis.bossart, kernel, festevam, linux-sound,
imx, linux-kernel
On Tue, Aug 19, 2025 at 2:29 PM Xichao Zhao <zhao.xichao@vivo.com> wrote:
>
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
NACK on this.
Quote from dev_err_probe documentation:
```
Using this helper in your probe function is totally fine even if @err
* is known to never be -EPROBE_DEFER.
* The benefit compared to a normal dev_err() is the standardized format
* of the error code, which is emitted symbolically (i.e. you get "EAGAIN"
* instead of "-35"), and having the error code returned allows more
* compact error paths.
```
Thanks,
Daniel.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe()
2025-08-20 7:04 ` Daniel Baluta
@ 2025-08-20 9:24 ` Laurentiu Mihalcea
2025-08-20 17:26 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Laurentiu Mihalcea @ 2025-08-20 9:24 UTC (permalink / raw)
To: Daniel Baluta, Xichao Zhao, Laurentiu Mihalcea
Cc: lgirdwood, peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, broonie, perex, tiwai, shawnguo, s.hauer,
kai.vehmanen, pierre-louis.bossart, kernel, festevam, linux-sound,
imx, linux-kernel
On 8/20/2025 10:04 AM, Daniel Baluta wrote:
> On Tue, Aug 19, 2025 at 2:29 PM Xichao Zhao <zhao.xichao@vivo.com> wrote:
>> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
>> Therefore, remove the useless call to dev_err_probe(), and just
>> return the value instead.
>>
>> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> NACK on this.
>
> Quote from dev_err_probe documentation:
>
> ```
> Using this helper in your probe function is totally fine even if @err
> * is known to never be -EPROBE_DEFER.
> * The benefit compared to a normal dev_err() is the standardized format
> * of the error code, which is emitted symbolically (i.e. you get "EAGAIN"
> * instead of "-35"), and having the error code returned allows more
> * compact error paths.
> ```
AFAIK the kernel logs are verbose enough on OOM errors, which makes prints
such as the ones removed by this series unneeded (have a look at [1]). Normally,
you'd get a warning from checkpatch but I think these logs slipped through the
cracks because the error messages do not quite match the expected format?
[1]: https://lkml.org/lkml/2014/6/10/382
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe()
2025-08-19 11:26 [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe() Xichao Zhao
2025-08-20 7:04 ` Daniel Baluta
@ 2025-08-20 9:29 ` Laurentiu Mihalcea
2025-08-25 20:04 ` Mark Brown
2 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Mihalcea @ 2025-08-20 9:29 UTC (permalink / raw)
To: Xichao Zhao, lgirdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, daniel.baluta, broonie, perex, tiwai, shawnguo,
s.hauer
Cc: kai.vehmanen, pierre-louis.bossart, kernel, festevam, linux-sound,
imx, linux-kernel
On 8/19/2025 2:26 PM, Xichao Zhao wrote:
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
> sound/soc/sof/imx/imx-common.c | 4 ++--
> sound/soc/sof/imx/imx8.c | 3 +--
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/sof/imx/imx-common.c b/sound/soc/sof/imx/imx-common.c
> index f00b381cec3b..4523621cda10 100644
> --- a/sound/soc/sof/imx/imx-common.c
> +++ b/sound/soc/sof/imx/imx-common.c
> @@ -354,8 +354,8 @@ static int imx_probe(struct snd_sof_dev *sdev)
>
> common = devm_kzalloc(sdev->dev, sizeof(*common), GFP_KERNEL);
> if (!common)
> - return dev_err_probe(sdev->dev, -ENOMEM,
> - "failed to allocate common data\n");
> + return -ENOMEM;
> +
> sdev->pdata->hw_pdata = common;
>
> common->ipc_dev = platform_device_register_data(sdev->dev, "imx-dsp",
> diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
> index b73dd91bd529..7e9eab2e3034 100644
> --- a/sound/soc/sof/imx/imx8.c
> +++ b/sound/soc/sof/imx/imx8.c
> @@ -171,8 +171,7 @@ static int imx8m_probe(struct snd_sof_dev *sdev)
>
> chip = devm_kzalloc(sdev->dev, sizeof(*chip), GFP_KERNEL);
> if (!chip)
> - return dev_err_probe(sdev->dev, -ENOMEM,
> - "failed to allocate chip data\n");
> + return -ENOMEM;
>
> chip->dap = devm_ioremap(sdev->dev, IMX8M_DAP_DEBUG, IMX8M_DAP_DEBUG_SIZE);
> if (!chip->dap)
Good stuff, thanks! Maybe it would be worth mentioning in the commit
message that generic messages on OOM errors such as these ones are unneeded
since the kernel is already verbose enough? This seems to be the reason why
dev_err_probe() doesn't do anything on -ENOMEM anyways.
Either way:
Reviewed-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe()
2025-08-20 9:24 ` Laurentiu Mihalcea
@ 2025-08-20 17:26 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-08-20 17:26 UTC (permalink / raw)
To: Laurentiu Mihalcea
Cc: Daniel Baluta, Xichao Zhao, Laurentiu Mihalcea, lgirdwood,
peter.ujfalusi, yung-chuan.liao, ranjani.sridharan, daniel.baluta,
perex, tiwai, shawnguo, s.hauer, kai.vehmanen,
pierre-louis.bossart, kernel, festevam, linux-sound, imx,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 998 bytes --]
On Wed, Aug 20, 2025 at 12:24:40PM +0300, Laurentiu Mihalcea wrote:
> On 8/20/2025 10:04 AM, Daniel Baluta wrote:
> > On Tue, Aug 19, 2025 at 2:29 PM Xichao Zhao <zhao.xichao@vivo.com> wrote:
> >> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> >> Therefore, remove the useless call to dev_err_probe(), and just
> >> return the value instead.
> > NACK on this.
> > Quote from dev_err_probe documentation:
> >
> > ```
> > Using this helper in your probe function is totally fine even if @err
> AFAIK the kernel logs are verbose enough on OOM errors, which makes prints
>
> such as the ones removed by this series unneeded (have a look at [1]). Normally,
>
> you'd get a warning from checkpatch but I think these logs slipped through the
>
> cracks because the error messages do not quite match the expected format?
Indeed, there's generally no need for any additional logging on OOM and
if the code is fixed there's no possibility of deferral.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe()
2025-08-19 11:26 [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe() Xichao Zhao
2025-08-20 7:04 ` Daniel Baluta
2025-08-20 9:29 ` Laurentiu Mihalcea
@ 2025-08-25 20:04 ` Mark Brown
2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-08-25 20:04 UTC (permalink / raw)
To: lgirdwood, peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, perex, tiwai, shawnguo, s.hauer, Xichao Zhao
Cc: kai.vehmanen, pierre-louis.bossart, kernel, festevam, linux-sound,
imx, linux-kernel
On Tue, 19 Aug 2025 19:26:54 +0800, Xichao Zhao wrote:
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SOF: imx: Remove the use of dev_err_probe()
commit: f840737d1746398c2993be34bfdc80bdc19ecae2
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-25 20:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 11:26 [PATCH] ASoC: SOF: imx: Remove the use of dev_err_probe() Xichao Zhao
2025-08-20 7:04 ` Daniel Baluta
2025-08-20 9:24 ` Laurentiu Mihalcea
2025-08-20 17:26 ` Mark Brown
2025-08-20 9:29 ` Laurentiu Mihalcea
2025-08-25 20:04 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).