usb: isp1760: compress return logic into one line
Subsystems (2)
PATCH 1/1 usb: isp1760: compress return logic into one line
Simplify return logic to avoid unnecessary variable assignment.
This issue was detected using Coccinelle and the following semantic patch:
@@
local idexpression ret;
expression e;
@@
-ret =
+return
e;
-return ret;
--- drivers/usb/isp1760/isp1760-hcd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/isp1760/isp1760-hcd.c +2 -4
@@ -396,7 +396,6 @@ static int handshake(struct usb_hcd *hcd, u32 reg,/* reset a non-running (STS_HALT == 1) controller */ static int ehci_reset (struct usb_hcd *hcd) { -int retval;struct isp1760_hcd *priv =hcd_to_priv (hcd);u32 command =reg_read32 (hcd->regs,HC_USBCMD );
@@ -405,9 +404,8 @@ static int ehci_reset(struct usb_hcd *hcd)reg_write32 (hcd->regs,HC_USBCMD , command); hcd->state =HC_STATE_HALT ; priv->next_statechange = jiffies; - retval =handshake (hcd,HC_USBCMD , -CMD_RESET ,0 ,250 *1000 ); -return retval; + +return handshake (hcd,HC_USBCMD ,CMD_RESET ,0 ,250 *1000 ); }static struct isp1760_qh *qh_alloc (gfp_t flags)
Signature · 1 line
2.5.0
Am Sonntag, den 09.07.2017, 21:00 -0500 schrieb Gustavo A. R. Silva :
Quoted 5 lines
Simplify return logic to avoid unnecessary variable assignment.
This issue was detected using Coccinelle and the following semantic patch:
Hi,
I need to ask: Where is the improvement? The compiler does not bother and for the human reader you do not do anything obvious and you decreased grepability.
Regards
Oliver
Hi Oliver,
Quoting Oliver Neukum <[email protected]>:
Quoted 7 lines
Am Sonntag, den 09.07.2017, 21:00 -0500 schrieb Gustavo A. R. Silva :
Quoted 5 lines
Simplify return logic to avoid unnecessary variable assignment.
This issue was detected using Coccinelle and the following semantic patch:
Quoted 6 lines
Hi,
I need to ask: Where is the improvement? The compiler does not bother and for the human reader you do not do anything obvious and you decreased grepability.
The declaration of local variable _retval_ was removed also. So both, variable declaration and assignment removal are the improvements.
Regarding the greability, I think that depends on the context.
Thanks!
--
Gustavo A. R. Silva
Am Montag, den 10.07.2017, 14:58 -0500 schrieb Gustavo A. R. Silva :
Quoted 15 lines
Hi Oliver,
Quoting Oliver Neukum <[email protected]>:
Quoted 11 lines
Am Sonntag, den 09.07.2017, 21:00 -0500 schrieb Gustavo A. R. Silva :
Quoted 6 lines
Simplify return logic to avoid unnecessary variable assignment.
This issue was detected using Coccinelle and the following semantic patch:
Hi,
Quoted 7 lines
Quoted 4 lines
I need to ask: Where is the improvement? The compiler does not bother and for the human reader you do not do anything obvious and you decreased grepability.
The declaration of local variable _retval_ was removed also. So both, variable declaration and assignment removal are the improvements.
Yeah, but a variable called "retval" has an extremely clear function. Simplifying code is an improvement. Making it clearer is an improvement.
I am sorry but the proposed change is almost like removing blank lines to make it more compact
Quoted 1 line
Regarding the greability, I think that depends on the context.
"retval" has a clear function and is unique.
Regards
Oliver