Re: [PATCH] crypto: ccp: Use scoped guard for mutex

From: Tom Lendacky
Date: Mon Nov 11 2024 - 09:28:36 EST


On 11/8/24 20:00, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@xxxxxxx>
>
> Using a scoped guard simplifies the cleanup handling.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
> ---
> drivers/crypto/ccp/dbc.c | 48 +++++++++++++++-------------------------
> 1 file changed, 18 insertions(+), 30 deletions(-)
>

> default:
> ret = -EINVAL;

Might as well make this a return -EINVAL and get rid of the return ret
at the end of the function, too.

Thanks,
Tom

>
> }
> -unlock:
> - mutex_unlock(&dbc_dev->ioctl_mutex);
>
> return ret;
> }