Re: [PATCH v5] locking/mutex: Mark devm_mutex_init() as __must_check
From: Bartosz Golaszewski
Date: Mon May 05 2025 - 04:27:28 EST
On Mon, May 5, 2025 at 10:00 AM Thomas Weißschuh <linux@xxxxxxxxxxxxxx> wrote:
>
> Even if it's not critical, the avoidance of checking the error code
> from devm_mutex_init() call today diminishes the point of using the devm
> variant of it. Tomorrow it may even leak something. Enforce all callers
> checking the return value through the compiler.
>
> As devm_mutex_init() itself is a macro, it can not be annotated
> directly. Annotate __devm_mutex_init() instead.
> Unfortunately __must_check/warn_unused_result don't propagate through
> statement expression. So move the statement expression into the argument
> list of the call to __devm_mutex_init() through a helper macro.
>
> Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
LGTM
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>