Skip to content

Commit 2f3cfd2

Browse files
ukleinekgregkh
authored andcommitted
driver core: Make dev_err_probe() silent for -ENOMEM
For an out-of-memory error there should be no additional output. Adapt dev_err_probe() to not emit the error message when err is -ENOMEM. This simplifies handling errors that might among others be -ENOMEM. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/3d1e308d45cddf67749522ca42d83f5b4f0b9634.1718311756.git.u.kleine-koenig@baylibre.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent de65828 commit 2f3cfd2

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

drivers/base/core.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5021,11 +5021,22 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
50215021
vaf.fmt = fmt;
50225022
vaf.va = &args;
50235023

5024-
if (err != -EPROBE_DEFER) {
5025-
dev_err(dev, "error %pe: %pV", ERR_PTR(err), &vaf);
5026-
} else {
5024+
switch (err) {
5025+
case -EPROBE_DEFER:
50275026
device_set_deferred_probe_reason(dev, &vaf);
50285027
dev_dbg(dev, "error %pe: %pV", ERR_PTR(err), &vaf);
5028+
break;
5029+
5030+
case -ENOMEM:
5031+
/*
5032+
* We don't print anything on -ENOMEM, there is already enough
5033+
* output.
5034+
*/
5035+
break;
5036+
5037+
default:
5038+
dev_err(dev, "error %pe: %pV", ERR_PTR(err), &vaf);
5039+
break;
50295040
}
50305041

50315042
va_end(args);

0 commit comments

Comments
 (0)