From: David Binder Date: Thu, 12 May 2016 13:14:45 +0000 (-0400) Subject: staging: unisys: visornic: simplify visornic if statements X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6d8c96cbc161168726480ab01ad5c53fd6b2e04a;p=openwrt%2Fstaging%2Fblogic.git staging: unisys: visornic: simplify visornic if statements Changes the conditional logic by looking for the absence of work to do, instead of the opposite. Signed-off-by: David Binder Reviewed-by: Tim Sell Signed-off-by: David Kershner Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index fd7c9a6cb6f3..992543ae2c93 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -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; } /**