staging: unisys: use common return path
PATCH v2 1/1 staging: unisys: use common return path
The success path and the error path both are first doing spin_unlock_irqrestore() before returning. Use that in the common path and return the success/error value.
---
v2: changed label name
It is dependent on the patch series sent by Benjamin (Nov 30th).
drivers/staging/unisys/visornic/visornic_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/staging/unisys/visornic/visornic_main.c +7 -5
@@ -357,15 +357,16 @@ visornic_serverdown(struct visornic_devdata *devdata, visorbus_state_complete_func complete_func) {unsigned long flags; +int retval =0 ;spin_lock_irqsave (&devdata->priv_lock, flags);if (!devdata->server_down && !devdata->server_change_state) {if (devdata->going_away) { -spin_unlock_irqrestore (&devdata->priv_lock, flags);dev_dbg (&devdata->dev->device,"%s aborting because device removal pending\n" , __func__); -return -ENODEV ; + retval = -ENODEV ; + goto error; } devdata->server_change_state = true; devdata->server_down_complete_func = complete_func;
@@ -374,11 +375,12 @@ visornic_serverdown(struct visornic_devdata *devdata, }else if (devdata->server_change_state) {dev_dbg (&devdata->dev->device,"%s changing state\n" , __func__); -spin_unlock_irqrestore (&devdata->priv_lock, flags); -return -EINVAL ; + retval = -EINVAL ; } + +unlock:spin_unlock_irqrestore (&devdata->priv_lock, flags); -return 0 ; +return retval; }/**
Signature · 1 line
1.9.1
Greg Kroah-Hartman
maintainerQuoted 10 lines · Sudip Mukherjee
The success path and the error path both are first doing
spin_unlock_irqrestore()before returning. Use that in the common path and return the success/error value.Signed-off-by Sudip Mukherjee <[email protected]>---
v2: changed label name
It is dependent on the patch series sent by Benjamin (Nov 30th).
Which didn't get applied, so can you resend this after that does get accepted?
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Sudip Mukherjee
The success path and the error path both are first doing
spin_unlock_irqrestore()before returning. Use that in the common path and return the success/error value.Signed-off-by Sudip Mukherjee <[email protected]>---
Quoted 6 lines
Quoted 3 lines
v2: changed label name
It is dependent on the patch series sent by Benjamin (Nov 30th).
Which didn't get applied, so can you resend this after that does get accepted?
oops, i dont think i have the patch anymore. But looking at the commit message, i think i just sent the same suggestion to Benjamin for his [PATCH v3 13/14] staging: unisys: fix else statement in visornic_main.c
If he is not changing then I will create the patch and send you.
regards
sudip
Quoted 13 lines · Sudip Mukherjee
Quoted 12 lines · Greg Kroah-Hartman
Quoted 10 lines · Sudip Mukherjee
The success path and the error path both are first doing
spin_unlock_irqrestore()before returning. Use that in the common path and return the success/error value.Signed-off-by Sudip Mukherjee <[email protected]>---
v2: changed label name
It is dependent on the patch series sent by Benjamin (Nov 30th).
Quoted 8 lines
Quoted 2 lines
Which didn't get applied, so can you resend this after that does get accepted?
oops, i dont think i have the patch anymore. But looking at the commit message, i think i just sent the same suggestion to Benjamin for his [PATCH v3 13/14] staging: unisys: fix else statement in
visornic_main.cIf he is not changing then I will create the patch and send you.
Hi Greg,
I will not be resending this patch as Ben is against to using goto.
regards
sudip