wifi: rtw88: Remove duplicate NULL check before calling usb_kill/free_urb()
authorJinjie Ruan <ruanjinjie@huawei.com>
Sun, 8 Oct 2023 02:58:52 +0000 (10:58 +0800)
committerKalle Valo <kvalo@kernel.org>
Wed, 11 Oct 2023 09:17:46 +0000 (12:17 +0300)
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 <ruanjinjie@huawei.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231008025852.1239450-1-ruanjinjie@huawei.com
drivers/net/wireless/realtek/rtw88/usb.c

index d879d7e3dc81fe6bb80057bbb2c5cfc24e8a6dde..e6ab1ac6d70934d9afb8e9a018054b6c0233239a 100644 (file)
@@ -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);
        }
 }