From nobody Mon Sep 15 19:47:09 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69377C46467 for ; Tue, 10 Jan 2023 20:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234232AbjAJU5C (ORCPT ); Tue, 10 Jan 2023 15:57:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233891AbjAJU4r (ORCPT ); Tue, 10 Jan 2023 15:56:47 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A51CB12A94 for ; Tue, 10 Jan 2023 12:56:44 -0800 (PST) Received: from dslb-178-004-206-224.178.004.pools.vodafone-ip.de ([178.4.206.224] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pFLfi-0001pw-NV; Tue, 10 Jan 2023 21:56:38 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 1/4] staging: r8188eu: refactor status handling in usb_write_port_complete Date: Tue, 10 Jan 2023 21:56:23 +0100 Message-Id: <20230110205626.183516-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230110205626.183516-1-martin@kaiser.cx> References: <20230110205626.183516-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- .../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/stagi= ng/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, s= truct pt_regs *regs) padapter->bWritePortCancel) goto check_completion; =20 - if (purb->status) { - if (purb->status =3D=3D -EINPROGRESS) { - goto check_completion; - } else if (purb->status =3D=3D -ENOENT) { - goto check_completion; - } else if (purb->status =3D=3D -ECONNRESET) { - goto check_completion; - } else if (purb->status =3D=3D -ESHUTDOWN) { - padapter->bDriverStopped =3D true; - goto check_completion; - } else if ((purb->status !=3D -EPIPE) && (purb->status !=3D -EPROTO)) { - padapter->bSurpriseRemoved =3D true; - - goto check_completion; - } + switch (purb->status) { + case 0: + case -EINPROGRESS: + case -ENOENT: + case -ECONNRESET: + case -EPIPE: + case -EPROTO: + break; + case -ESHUTDOWN: + padapter->bDriverStopped =3D true; + break; + default: + padapter->bSurpriseRemoved =3D true; + break; } =20 check_completion: --=20 2.30.2