staging: rtl8192e: Fix preceding lock warning
PATCH 1/1 staging: rtl8192e: Fix preceding lock warning
This patch fixes a "preceding lock" warning by removing a return before the unlock operation. Also removes an unnecessary goto and adds a else if condition that archives the same behavior. Issue found by Coccinelle.
--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1 -6
@@ -422,16 +422,11 @@ int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a,if (ieee->iw_mode ==IW_MODE_MONITOR || !(ieee->proto_started)) { ret =-1 ; - goto out; - } - -if (ieee->state ==RTLLIB_LINKED ) { + }else if (ieee->state ==RTLLIB_LINKED ) {schedule_work (&ieee->wx_sync_scan_wq);/* intentionally forget to up sem */ -return 0 ; } -out:mutex_unlock (&ieee->wx_mutex);return ret; }
Signature · 1 line
2.20.1
Quoted 16 lines · Javier F. Arias
This patch fixes a "preceding lock" warning by removing a return before the unlock operation. Also removes an unnecessary goto and adds a else if condition that archives the same behavior. Issue found by Coccinelle.
Signed-off-by Javier F. Arias <[email protected]>--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-0@@ -422,16 +422,11 @@ int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a,
drivers/staging/rtl8192e/rtllib_softmac_wx.c int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a, · line 431
Quoted 10 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1
-5if (ieee->iw_mode ==IW_MODE_MONITOR || !(ieee->proto_started)) { ret =-1 ; - goto out; - } - -if (ieee->state ==RTLLIB_LINKED ) { + }else if (ieee->state ==RTLLIB_LINKED ) {schedule_work (&ieee->wx_sync_scan_wq);/* intentionally forget to up sem */ -return 0 ;
The change does not seem likely to be correct, given the comment in the code. Coccinelle only knows about the structure of the code in the given file. Here the developer clearly believes that there are some other issues that have to be taken into account.
julia
Quoted 14 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-2} -out:mutex_unlock (&ieee->wx_mutex);return ret; } --2.20.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191101051701.c3wly47ld6jg6hgn%40gmail.com.
Quoted 47 lines · Julia Lawall
Quoted 16 lines · Javier F. Arias
This patch fixes a "preceding lock" warning by removing a return before the unlock operation. Also removes an unnecessary goto and adds a else if condition that archives the same behavior. Issue found by Coccinelle.
Signed-off-by Javier F. Arias <[email protected]>--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-0@@ -422,16 +422,11 @@ int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a,drivers/staging/rtl8192e/rtllib_softmac_wx.c int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a, · line 431
Quoted 10 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1
-5if (ieee->iw_mode ==IW_MODE_MONITOR || !(ieee->proto_started)) { ret =-1 ; - goto out; - } - -if (ieee->state ==RTLLIB_LINKED ) { + }else if (ieee->state ==RTLLIB_LINKED ) {schedule_work (&ieee->wx_sync_scan_wq);/* intentionally forget to up sem */ -return 0 ;The change does not seem likely to be correct, given the comment in the code. Coccinelle only knows about the structure of the code in the given file. Here the developer clearly believes that there are some other issues that have to be taken into account.
julia
Quoted 9 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-2} -out:mutex_unlock (&ieee->wx_mutex);return ret; } --2.20.1
Quoted 10 lines
Quoted 5 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191101051701.c3wly47ld6jg6hgn%40gmail.com.Signature · 3 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1911010827190.2883%40hadrien.
Hello Julia,
Thanks for your feedback. You are right, in this case only the developing team knows. I'll find another issue.