Re: [PATCH v2 4/7] remoteproc: core: Use cleanup.h macros to simplify lock handling

Peng Fan
2025-10-14T09:43:30Z

Hi Andrew,

Thanks for your reviewing.

On Fri, Oct 10, 2025 at 07:34:13PM -0500, Andrew Davis wrote:
>On 10/10/25 7:24 AM, Peng Fan wrote:
>> Replace manual mutex_lock/unlock and error-handling patterns with cleanup.h
>> macros (ACQUIRE, ACQUIRE_ERR, and scoped_guard) to streamline lock
>> management. As a result, several goto labels and redundant error paths are
>> eliminated.
>>
>> -
>> - if (rproc->state == RPROC_CRASHED) {
>> + scoped_guard(mutex, &rproc->lock) {
>
>Not sure this one is worth switching to scoped_guard as is doesn't save
>us needing the goto out label. Plus it adds indent to a bunch of lines.

I was thinking to align the usage of cleanup API, avoiding mix the usage
the cleanup API and direct usage of mutex_lock/unlock API.

Considering the deadlock report [1], we may need to rethink the lock
scope in remoteproc_core.c. I gave a look on ->lock, but it is a bit
vague on which exact entries in rproc it is protecting.
Before [1] is fixed, this patch might be dropped.

Thanks
Peng

[1]https://lore.kernel.org/linux-remoteproc/6460478.iFIW2sfyFC@nailgun/T/#u