cfg80211: combine two nested ifs into a single condition
authorJohannes Berg <johannes.berg@intel.com>
Mon, 13 Feb 2017 19:53:38 +0000 (20:53 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 6 Mar 2017 08:21:40 +0000 (09:21 +0100)
Combine two instances of having two nested if statements
into a single one with a combined condition to reduce the
indentation.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/core.c
net/wireless/util.c

index 04143df20f7ff0e5b944329e32f60dd7767437d9..76e664144c8e402172ed5c985bde3810e3551432 100644 (file)
@@ -1216,12 +1216,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                 */
                if ((wdev->iftype == NL80211_IFTYPE_STATION ||
                     wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
-                   rdev->ops->set_power_mgmt)
-                       if (rdev_set_power_mgmt(rdev, dev, wdev->ps,
-                                               wdev->ps_timeout)) {
-                               /* assume this means it's off */
-                               wdev->ps = false;
-                       }
+                   rdev->ops->set_power_mgmt &&
+                   rdev_set_power_mgmt(rdev, dev, wdev->ps,
+                                       wdev->ps_timeout)) {
+                       /* assume this means it's off */
+                       wdev->ps = false;
+               }
                break;
        case NETDEV_UNREGISTER:
                /*
index 68e5f2ecee1aa22f17ab9a55eb566124e585740b..daef500a7b64d870899d89fe028fd84ce1bf3a4b 100644 (file)
@@ -914,11 +914,11 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev)
                        netdev_err(dev, "failed to set key %d\n", i);
                        continue;
                }
-               if (wdev->connect_keys->def == i)
-                       if (rdev_set_default_key(rdev, dev, i, true, true)) {
-                               netdev_err(dev, "failed to set defkey %d\n", i);
-                               continue;
-                       }
+               if (wdev->connect_keys->def == i &&
+                   rdev_set_default_key(rdev, dev, i, true, true)) {
+                       netdev_err(dev, "failed to set defkey %d\n", i);
+                       continue;
+               }
        }
 
        kzfree(wdev->connect_keys);