Re: [PATCH] android: binderfs: drop manual unlock via scoped_guard()

From: Greg KH

Date: Tue Jun 16 2026 - 21:27:25 EST


On Tue, Jun 16, 2026 at 11:23:41PM +0530, Biren Pandya wrote:
> The device_create function manually protects the minor number allocation
> with binderfs_minors_mutex and relies on multiple manual unlocks on
> success and error paths. This is error-prone and adds boilerplate.
>
> Refactor the critical section to use the modern scoped_guard(mutex)
> macro. This strictly binds the lock lifecycle to the scope block,
> completely eliminating the manual unlocks and guaranteeing lock
> safety against future code modifications.

We don't do scope guard changes that don't actually fix a bug, as it's
not needed. Otherwise we would be rewriting large chunks of the kernel
for it.

thanks,

greg k-h