2014-02-24 10:23:30

by Daeseok Youn

[permalink] [raw]
Subject: [PATCH v2] staging: ced401: fix double unlock bug


After spin_lock() is called, all of if-else conditions in this brace
should reach the end of else and spin_unlock() must be called.
So It doesn't need to call spin_unlock() without a return statement
for handling an error.

Also sparse says:
drivers/staging/ced1401/usb1401.c:1080:28: warning:
context imbalance in 'Handle1401Esc' - unexpected unlock

Signed-off-by: Daeseok Youn <[email protected]>
---
drivers/staging/ced1401/usb1401.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/ced1401/usb1401.c b/drivers/staging/ced1401/usb1401.c
index efc310c..8195eb9 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1053,7 +1053,6 @@ static int Handle1401Esc(DEVICE_EXTENSION *pdx, char *pCh,
/* This can never happen, really */
dev_err(&pdx->interface->dev,
"ERROR: DMA setup while transfer still waiting");
- spin_unlock(&pdx->stagedLock);
} else {
if ((wTransType == TM_EXTTOHOST)
|| (wTransType == TM_EXTTO1401)) {
--
1.7.9.5

---


2014-02-24 10:32:09

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v2] staging: ced401: fix double unlock bug

On Mon, Feb 24, 2014 at 07:23:15PM +0900, Daeseok Youn wrote:
>
> After spin_lock() is called, all of if-else conditions in this brace
> should reach the end of else and spin_unlock() must be called.
> So It doesn't need to call spin_unlock() without a return statement
> for handling an error.
>
> Also sparse says:
> drivers/staging/ced1401/usb1401.c:1080:28: warning:
> context imbalance in 'Handle1401Esc' - unexpected unlock
>

Thank you.

Reviewed-by: Dan Carpenter <[email protected]>

regards,
dan carpenter

2014-02-25 00:42:26

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] staging: ced401: fix double unlock bug

On Mon, Feb 24, 2014 at 07:23:15PM +0900, Daeseok Youn wrote:
>
> After spin_lock() is called, all of if-else conditions in this brace
> should reach the end of else and spin_unlock() must be called.
> So It doesn't need to call spin_unlock() without a return statement
> for handling an error.
>
> Also sparse says:
> drivers/staging/ced1401/usb1401.c:1080:28: warning:
> context imbalance in 'Handle1401Esc' - unexpected unlock
>
> Signed-off-by: Daeseok Youn <[email protected]>

This patch doesn't apply to my tree, can you please redo it against
linux-next and resend it so that I can apply it?

thanks,

greg k-h

2014-02-25 01:07:15

by Daeseok Youn

[permalink] [raw]
Subject: Re: [PATCH v2] staging: ced401: fix double unlock bug

Ok.

I will make a patch based on linux-next branch and send it again.
Thanks.

Daeseok Youn

2014-02-25 9:43 GMT+09:00 Greg KH <[email protected]>:
> On Mon, Feb 24, 2014 at 07:23:15PM +0900, Daeseok Youn wrote:
>>
>> After spin_lock() is called, all of if-else conditions in this brace
>> should reach the end of else and spin_unlock() must be called.
>> So It doesn't need to call spin_unlock() without a return statement
>> for handling an error.
>>
>> Also sparse says:
>> drivers/staging/ced1401/usb1401.c:1080:28: warning:
>> context imbalance in 'Handle1401Esc' - unexpected unlock
>>
>> Signed-off-by: Daeseok Youn <[email protected]>
>
> This patch doesn't apply to my tree, can you please redo it against
> linux-next and resend it so that I can apply it?
>
> thanks,
>
> greg k-h