staging: unisys: visornic: simplify visornic if statements
authorDavid Binder <david.binder@unisys.com>
Thu, 12 May 2016 13:14:45 +0000 (09:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Jun 2016 05:55:19 +0000 (22:55 -0700)
Changes the conditional logic by looking for the absence of work
to do, instead of the opposite.

Signed-off-by: David Binder <david.binder@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visornic/visornic_main.c

index fd7c9a6cb6f3ba5e1c87904f12ceee2c7dddc175..992543ae2c938c9870e4e20340eb4f40b0f01d97 100644 (file)
@@ -1000,25 +1000,28 @@ visornic_set_multi(struct net_device *netdev)
        struct uiscmdrsp *cmdrsp;
        struct visornic_devdata *devdata = netdev_priv(netdev);
 
-       /* any filtering changes */
-       if (devdata->old_flags != netdev->flags) {
-               if ((netdev->flags & IFF_PROMISC) !=
-                   (devdata->old_flags & IFF_PROMISC)) {
-                       cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
-                       if (!cmdrsp)
-                               return;
-                       cmdrsp->cmdtype = CMD_NET_TYPE;
-                       cmdrsp->net.type = NET_RCV_PROMISC;
-                       cmdrsp->net.enbdis.context = netdev;
-                       cmdrsp->net.enbdis.enable =
-                               netdev->flags & IFF_PROMISC;
-                       visorchannel_signalinsert(devdata->dev->visorchannel,
-                                                 IOCHAN_TO_IOPART,
-                                                 cmdrsp);
-                       kfree(cmdrsp);
-               }
-               devdata->old_flags = netdev->flags;
-       }
+       if (devdata->old_flags == netdev->flags)
+               return;
+
+       if ((netdev->flags & IFF_PROMISC) ==
+           (devdata->old_flags & IFF_PROMISC))
+               goto out_save_flags;
+
+       cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
+       if (!cmdrsp)
+               return;
+       cmdrsp->cmdtype = CMD_NET_TYPE;
+       cmdrsp->net.type = NET_RCV_PROMISC;
+       cmdrsp->net.enbdis.context = netdev;
+       cmdrsp->net.enbdis.enable =
+               netdev->flags & IFF_PROMISC;
+       visorchannel_signalinsert(devdata->dev->visorchannel,
+                                 IOCHAN_TO_IOPART,
+                                 cmdrsp);
+       kfree(cmdrsp);
+
+out_save_flags:
+       devdata->old_flags = netdev->flags;
 }
 
 /**