staging: rtl8192u: Fix keyidx assignment within if condition
authorWang Jinchao <wangjinchao600@gmail.com>
Tue, 4 Jul 2023 15:33:09 +0000 (23:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2023 08:00:02 +0000 (10:00 +0200)
Refactor the if condition into nested conditionals to improve clarity.
The condition is currently in the form of (E1 && E2 && E3), where the
variable keyidx is assigned a value in E3.

Signed-off-by: Wang Jinchao <wangjinchao600@gmail.com>
Link: https://lore.kernel.org/r/ZKQ7tYa9I+PHgef/@fedora
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c

index ca09367005e171a21532c3924d5c5f12526bfb4b..5da8ac401df07db5e5e810c4f11c38b9a380dc9d 100644 (file)
@@ -1121,10 +1121,12 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 
        /* skb: hdr + (possibly fragmented, possibly encrypted) payload */
 
-       if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
-           (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) {
-               netdev_dbg(ieee->dev, "decrypt frame error\n");
-               goto rx_dropped;
+       if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP)) {
+               keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt);
+               if (keyidx < 0) {
+                       netdev_dbg(ieee->dev, "decrypt frame error\n");
+                       goto rx_dropped;
+               }
        }