Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8437507rwl; Tue, 10 Jan 2023 13:38:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuAW3W4iR6L6f9Aodmfu3oD2+yrBUDwtv6TaYRHOuqinURBc52+cJgT60IlbUNExHUTA2sl X-Received: by 2002:a17:906:a18c:b0:7c1:5467:39b1 with SMTP id s12-20020a170906a18c00b007c1546739b1mr61795577ejy.72.1673386685962; Tue, 10 Jan 2023 13:38:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673386685; cv=none; d=google.com; s=arc-20160816; b=xASiwNCucdpwyrFZNGPu5HE2l9/Ik8GrqSFDThJerDwG0MoUM1yHWlzjzOAJBhN7KI ik8D/254+1JWgqerVz/RrIBEFgEFjA/zTsAOGHka7MpE/tIz7dNdGrWjOllB8uQdaH0p cwOilfA7JRwpfK1IQxThpGmTe84WMhVbaJNqJcrF/3e9ecsQ7EVaB7fJpO7kf0rZ0ck7 l9xSMtDvNhJdpa6I6eTgdJ/zZgbWAYgnj8yxUJGchOz6Nf+tBUqed6p6QOwX0ar1AYNB MtH35EiIuQOayRLcCb3HEpMPM9XxeX/5S+XEREQqYBFEhmfdfsYgLfpJ0+ohfE6wPu8K YU8w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b0073d9c412570si13681772ejw.785.2023.01.10.13.37.52; Tue, 10 Jan 2023 13:38:05 -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 + 53 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 Content-Transfer-Encoding: 8bit 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 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: -- 2.30.2