netvsc: fix ptr_ret.cocci warnings
authorWu Fengguang <fengguang.wu@intel.com>
Fri, 21 Jul 2017 18:54:43 +0000 (02:54 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Jul 2017 23:20:06 +0000 (16:20 -0700)
drivers/net/hyperv/netvsc_drv.c:737:8-14: WARNING: PTR_ERR_OR_ZERO can be used

 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 9749fed5d43d ("netvsc: use ERR_PTR to avoid dereference issues")
CC: stephen hemminger <stephen@networkplumber.org>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc_drv.c

index a164981c15f7a261eccbb29e85edf8d1c6c07309..9a9e269a25aeeb09c4858ba0aee50fda9586dc66 100644 (file)
@@ -734,7 +734,7 @@ static int netvsc_set_queues(struct net_device *net, struct hv_device *dev,
                return ret;
 
        net_device = rndis_filter_device_add(dev, &device_info);
-       return IS_ERR(net_device) ? PTR_ERR(net_device) : 0;
+       return PTR_ERR_OR_ZERO(net_device);
 }
 
 static int netvsc_set_channels(struct net_device *net,