From patchwork Tue Jan 10 20:56:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 41652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2968907wrt; Tue, 10 Jan 2023 13:06:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXv78RBw8+mUyBxmxzwzk7j8ltrL/tTxXYJ2G5fSktXPIZX4XepUj0rrrYw+JjuaUX5erc8B X-Received: by 2002:a17:906:5202:b0:7c1:4a3:10b6 with SMTP id g2-20020a170906520200b007c104a310b6mr58478239ejm.53.1673384767773; Tue, 10 Jan 2023 13:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673384767; cv=none; d=google.com; s=arc-20160816; b=mNwvzX0BnPTjQNel0V5hfBD9tLCPJ6sS6ylOm03cPc2Nfy7/g2Ix3vI/u3HU6I9uAi QwuvlL6T9FZi9WMOALOD0gLZmvL/r7PkABYynaRnzbXxZ6liXjlKT9XRK/xUsWylTdAh 0/by5Nqh0ogQGrrLEAgcDLLFVOpnPuzSFat+dDRKAtfG2PgJL1J2whTXCE2HqcL4i1y8 HVk+NY06/TN5XhxtWIrnRuJ5ktKYY03iu1/k+L1BJPrc43and8P0h2mZkXreCC6N5IsR dRBScc5z0PiYkXox7nhaNZCXmIzelcklULRvlVIbezva/zrcy8gHN8WoQqFFTCN855er Qr7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zE4J3o2888grPFMwQk4eYi07KXQPp7BePJrAnoS6UV8=; b=u8ZZjKIwdbqbaPHKFqjvQL9Wp1JTHPOMekQ/NZNh85cFoCuGep3L0w9jVXkHQd7L74 v+jvcmTYnyqnUxlAyWJ9f5gw1xoueD7vQlohEvXRkbc9t6oUfIJsjQf3o9VbAJvSmfER 5RgfF5Bq5+FN41G8wsaa0O0yz61zcaLcHvG5YKwAFOnOADvjXS/L4wn/PBMPC19WXYmT 0fJoJudLBNKsWyz7EZYyaOlOhWiGTkarB1zFyHcV//YKfP86Uyz9fdVzpTuEL480SdXs eKvrlHCL0eCeZWVf0kcI8Ieh7XPlqrweXxH+h1CAmKkeIGrf4Haa3rinMiD5fXdkxQ4J A3jA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o18-20020a170906975200b0084514612c25si13399391ejy.604.2023.01.10.13.05.44; Tue, 10 Jan 2023 13:06:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233501AbjAJU5A (ORCPT + 99 others); Tue, 10 Jan 2023 15:57:00 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754671105955186700?= X-GMAIL-MSGID: =?utf-8?q?1754671105955186700?= 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/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: