Commit 47bdd807 authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman
Browse files

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: default avatarMartin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20230110205626.183516-2-martin@kaiser.cx


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 001c773c
Loading
Loading
Loading
Loading
+14 −15
Original line number Diff line number Diff line
@@ -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) {
	switch (purb->status) {
	case 0:
	case -EINPROGRESS:
	case -ENOENT:
	case -ECONNRESET:
	case -EPIPE:
	case -EPROTO:
		break;
	case -ESHUTDOWN:
		padapter->bDriverStopped = true;
			goto check_completion;
		} else if ((purb->status != -EPIPE) && (purb->status != -EPROTO)) {
		break;
	default:
		padapter->bSurpriseRemoved = true;

			goto check_completion;
		}
		break;
	}

check_completion: