Re: [PATCH v2] iio: chemical: scd30: Use devm_mutex_init() over non-devm mutex_init()
From: Andy Shevchenko
Date: Thu Jun 04 2026 - 17:01:14 EST
On Thu, Jun 04, 2026 at 11:21:07AM -0500, Maxwell Doose wrote:
> On Thu, Jun 4, 2026 at 11:20 AM David Lechner <dlechner@xxxxxxxxxxxx> wrote:
> > On Thu, Jun 4, 2026 at 3:17 PM Maxwell Doose <m32285159@xxxxxxxxx> wrote:
...
> > > + ret = devm_mutex_init(dev, &state->lock);
> > > + if (ret)
> > > + return -ENOMEM;
> >
> > Why are we ignoring ret?
> >
> > I would expect:
> >
> > return ret;
>
> Gah, I must've Jonathan's + Andy's comments get to my head (He said it
> should likely only return -ENOMEM) :(
> I don't know if he'll want to tweak while applying or if I should just
> go back and resubmit.
What we meant is that:
- devm_mutex_init() may return only -ENOMEM as of today
- dev_err_probe() will ignore (print nothing) when err == -ENOMEM
It has nothing to do with the caller, we explained how callee do.
TL;DR: it should be simple return ret; as Jonathan said already.
--
With Best Regards,
Andy Shevchenko