Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1229588rdb; Sat, 7 Oct 2023 19:59:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHOZMjTV99gwGK+IEnzX8tOzn5pTMad1ljykVG/kuiX1wI3re5S0/eqVPNbL94fAJRGmW9 X-Received: by 2002:a05:6a00:3693:b0:693:479f:bd1c with SMTP id dw19-20020a056a00369300b00693479fbd1cmr10909757pfb.1.1696733998208; Sat, 07 Oct 2023 19:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696733998; cv=none; d=google.com; s=arc-20160816; b=b92d4afrBILyO8w33XJoF709vssJezDhUkZeS2/w1RhfCY1DEmIS62pIKYMw3Lx3Gd zWR7WkW+ygUN0QQmJQ9N4BeDJbm6k6a0WMc8msviZopsaWNEl8iW2niC9A2/MK2IJbtA h1GXZadbBGULmA7kXz+VtSQR7l8u5WuNsCce8A0x1jjmoOUCy7EoMCGF7sp6HEWpTKjk omYpGfi1keC/kruBhaxkox4nsT9iFu+ILBl5YJPI4kk0GYXx1G2BX3EoXVfUBU3vr8v2 jBFUG6QgIRr3cG/oa2UzdZa6YZRoiv8sEPS5HIklidyrxbkENQnl0zn+HCvUEXpvXE6N 7Z1w== 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 :message-id:date:subject:cc:to:from; bh=cLLmz/l2kNHb9PJETJj744oBmMW1EzbemLD15MMTG3U=; fh=h8EM8T00+aNd+LWioeh+mqEmPj5Jv96BBt1+w4kv/aY=; b=IHkv/7/csggkBx2S4vbmgbhaylTUaHweifdH7H2vtZrR+iHI2Do7QKPb2XAUcOycjI d2Y6JBSqk5QDiWMVo/LY92D8BMo6hgjDe19d3gGVSNhxQfBQcjhgW0llbMrfAWFnHOkw 7BNHSoFvijbAbx5AKzCvg2G6Dm6CkzYMJ5Crs8WzwQbY3jVHXCJ6B+I1dG3ZrZABqRI3 mC1twsfHBmDJPyuXCwvJ5vie0qeD1NxTosJ99mHl/8TNaEQH2wLcr5/0TxStYJNQXGg9 NdjSyMi9Ph9O4VrhG8/jGOOxsyXd6eA7qjYZ+ddvWnWrYuiY1cHUNwHirppLc2bg7CDn y/gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id o10-20020a056a001bca00b0068fca4405aasi4521051pfw.338.2023.10.07.19.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 19:59:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 1052D8031EA9; Sat, 7 Oct 2023 19:59:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344337AbjJHC7h (ORCPT + 52 others); Sat, 7 Oct 2023 22:59:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234226AbjJHC7g (ORCPT ); Sat, 7 Oct 2023 22:59:36 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 882DABF for ; Sat, 7 Oct 2023 19:59:32 -0700 (PDT) Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S36HT1JlYzTmNb; Sun, 8 Oct 2023 10:56:05 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sun, 8 Oct 2023 10:59:29 +0800 From: Jinjie Ruan To: , Ping-Ke Shih , Kalle Valo , neo_jou , Sascha Hauer , Hans Ulli Kroll CC: Subject: [PATCH] wifi: rtw88: Remove duplicate NULL check before calling usb_kill/free_urb() Date: Sun, 8 Oct 2023 10:58:52 +0800 Message-ID: <20231008025852.1239450-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sat, 07 Oct 2023 19:59:56 -0700 (PDT) X-Spam-Level: ** Both usb_kill_urb() and usb_free_urb() do the NULL check itself, so there is no need to duplicate it prior to calling. Fixes: a82dfd33d123 ("wifi: rtw88: Add common USB chip support") Signed-off-by: Jinjie Ruan --- drivers/net/wireless/realtek/rtw88/usb.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c index d879d7e3dc81..e6ab1ac6d709 100644 --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c @@ -611,8 +611,7 @@ static void rtw_usb_cancel_rx_bufs(struct rtw_usb *rtwusb) for (i = 0; i < RTW_USB_RXCB_NUM; i++) { rxcb = &rtwusb->rx_cb[i]; - if (rxcb->rx_urb) - usb_kill_urb(rxcb->rx_urb); + usb_kill_urb(rxcb->rx_urb); } } @@ -623,10 +622,8 @@ static void rtw_usb_free_rx_bufs(struct rtw_usb *rtwusb) for (i = 0; i < RTW_USB_RXCB_NUM; i++) { rxcb = &rtwusb->rx_cb[i]; - if (rxcb->rx_urb) { - usb_kill_urb(rxcb->rx_urb); - usb_free_urb(rxcb->rx_urb); - } + usb_kill_urb(rxcb->rx_urb); + usb_free_urb(rxcb->rx_urb); } } -- 2.34.1