diff mbox series

[-next] usb: gadget: midi2: fix missing unlock in f_midi2_block_opts_create()

Message ID 20230728085120.3192474-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Commit 6bb75eb9ff3acfc3e1f31c01d70e72b3b3637167
Headers show
Series [-next] usb: gadget: midi2: fix missing unlock in f_midi2_block_opts_create() | expand

Commit Message

Yang Yingliang July 28, 2023, 8:51 a.m. UTC
In the error path in f_midi2_block_opts_create(), mutex_unlock() is missed,
fix it by move the unlock after 'out' label.

Fixes: 29ee7a4dddd5 ("usb: gadget: midi2: Add configfs support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/gadget/function/f_midi2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Takashi Iwai July 28, 2023, 9:44 a.m. UTC | #1
On Fri, 28 Jul 2023 10:51:20 +0200,
Yang Yingliang wrote:
> 
> In the error path in f_midi2_block_opts_create(), mutex_unlock() is missed,
> fix it by move the unlock after 'out' label.
> 
> Fixes: 29ee7a4dddd5 ("usb: gadget: midi2: Add configfs support")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Thanks, Good catch!

Reviewed-by: Takashi Iwai <tiwai@suse.de>


Takashi

> ---
>  drivers/usb/gadget/function/f_midi2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c
> index f1c47753e0c1..5a971ba600fe 100644
> --- a/drivers/usb/gadget/function/f_midi2.c
> +++ b/drivers/usb/gadget/function/f_midi2.c
> @@ -2350,8 +2350,8 @@ static int f_midi2_block_opts_create(struct f_midi2_ep_opts *ep_opts,
>  	ep_opts->blks[blk] = block_opts;
>  	*block_p = block_opts;
>  
> -	mutex_unlock(&ep_opts->opts->lock);
>   out:
> +	mutex_unlock(&ep_opts->opts->lock);
>  	return ret;
>  }
>  
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c
index f1c47753e0c1..5a971ba600fe 100644
--- a/drivers/usb/gadget/function/f_midi2.c
+++ b/drivers/usb/gadget/function/f_midi2.c
@@ -2350,8 +2350,8 @@  static int f_midi2_block_opts_create(struct f_midi2_ep_opts *ep_opts,
 	ep_opts->blks[blk] = block_opts;
 	*block_p = block_opts;
 
-	mutex_unlock(&ep_opts->opts->lock);
  out:
+	mutex_unlock(&ep_opts->opts->lock);
 	return ret;
 }