dev_err_probe(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… dev_err_probe β€” probe error check and log helper ✨

okay bestie, so this page is dev_err_probe(9) from the Kernel API Manual β€” yes, that kernel, the big one 🐧 β€” and it's honestly such a glow-up of a helper. let me tell you all about it 🫢


✨ SYNOPSIS ✨

int dev_err_probe (const struct device *dev , int err , const char *fmt
, ... );

like, that's the whole vibe. one function, three-ish args, infinite slay πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the pointer to the struct device. your device. the main character πŸ‘‘
  • err β€” the error value to test. yes we're testing it, hold that thought 🧚
  • fmt β€” printf-style format string. you know the drill πŸ’–
  • ... β€” arguments as specified in the format string. the lil entourage 🌸

πŸ’– DESCRIPTION πŸ’–

so this helper implements the common pattern that's literally everywhere in probe functions for error checking. it prints a debug or error message depending on whether the error value is -EPROBE_DEFER, and then propagates the error upwards. iconique behavior, no notes πŸ’…

and bestie, in case of -EPROBE_DEFER it also sets the defer probe reason, which you can check later by reading the devices_deferred debugfs attribute. so it's not just logging, it's leaving receipts πŸ“βœ¨

it replaces this whole code sequence:

if (err != -EPROBE_DEFER)
        dev_err(dev, ...);
else
        dev_dbg(dev, ...);
return err;

with just:

return dev_err_probe(dev, err, ...);

the way that's so much shorter?? like, the compiler girlies ate with this one πŸ”₯


πŸ¦‹ a couple little things you should know πŸ¦‹

using this helper in your probe function is totally fine even if err is known to never be -EPROBE_DEFER. no gatekeeping here, it's valid 🌈

the benefit compared to a normal dev_err is the standardized format of the error code, which gets emitted symbolically β€” i.e. you get "EAGAIN" instead of "-35". way more readable, way more cutesy πŸŽ€ and having the error code returned allows more compact error paths. tidy queen behavior ✨

Returns err. that's it. that's the return. it returns err πŸ’œ


🌸 SEE ALSO 🌸

kernel file ./drivers/base/core.c, plus the whole extended friend group of device/devlink/fwnode lore β€” not me listing every single one, but bestie i promised no skips so here we go πŸ’€


and that's the page!! mwah πŸ’‹ this one lives in ./drivers/base and it's dated October 2026, and the page itself is literally just dev_err_probe(9) β€” so yeah, go forth and return your errors cute and symbolic βœ¨πŸŽ€πŸ’œ

πŸ“¦ where this page comes from