Re: [PATCH] staging: most: net: use guard(mutex) for probe_disc_mt

From: Greg Kroah-Hartman

Date: Fri Nov 20 2026 - 02:17:06 EST


On Fri, Nov 13, 2026 at 10:53:58PM -0800, Niloy Meharchandani wrote:
> Replace manual mutex_lock() and mutex_unlock() calls on probe_disc_mt
> with guard(mutex)(&probe_disc_mt) in most_nd_open(), comp_probe_channel(),
> and comp_disconnect_channel(). Include <linux/cleanup.h> and
> <linux/mutex.h> explicitly.
>
> This simplifies error paths by removing the unlock goto labels and
> temporary return variables while ensuring the mutex is always released
> on scope exit.
>
> No functional change intended. Compile-tested only.

Only do this for new code, never touch existing code like this, it's not
needed.

thanks,

greg k-h