[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230110205626.183516-2-martin@kaiser.cx>
Date: Tue, 10 Jan 2023 21:56:23 +0100
From: Martin Kaiser <martin@...ser.cx>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>,
Michael Straube <straube.linux@...il.com>,
Pavel Skripkin <paskripkin@...il.com>,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Martin Kaiser <martin@...ser.cx>
Subject: [PATCH 1/4] staging: r8188eu: refactor status handling in usb_write_port_complete
Refactor the satus handling in usb_write_port_complete. Make it clearer
what happens for each status and avoid all the goto statements.
Signed-off-by: Martin Kaiser <martin@...ser.cx>
---
.../staging/r8188eu/os_dep/usb_ops_linux.c | 29 +++++++++----------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
index 257bcf496012..8494b80a08e5 100644
--- a/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/os_dep/usb_ops_linux.c
@@ -48,21 +48,20 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs)
padapter->bWritePortCancel)
goto check_completion;
- if (purb->status) {
- if (purb->status == -EINPROGRESS) {
- goto check_completion;
- } else if (purb->status == -ENOENT) {
- goto check_completion;
- } else if (purb->status == -ECONNRESET) {
- goto check_completion;
- } else if (purb->status == -ESHUTDOWN) {
- padapter->bDriverStopped = true;
- goto check_completion;
- } else if ((purb->status != -EPIPE) && (purb->status != -EPROTO)) {
- padapter->bSurpriseRemoved = true;
-
- goto check_completion;
- }
+ switch (purb->status) {
+ case 0:
+ case -EINPROGRESS:
+ case -ENOENT:
+ case -ECONNRESET:
+ case -EPIPE:
+ case -EPROTO:
+ break;
+ case -ESHUTDOWN:
+ padapter->bDriverStopped = true;
+ break;
+ default:
+ padapter->bSurpriseRemoved = true;
+ break;
}
check_completion:
--
2.30.2
Powered by blists - more mailing lists