diff mbox

netvsc: fix ptr_ret.cocci warnings

Message ID 20170721185443.GA18015@lkp-g5.lkp.intel.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

kbuild test robot July 21, 2017, 6:54 p.m. UTC
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>
---

 netvsc_drv.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller July 24, 2017, 11:20 p.m. UTC | #1
From: kbuild test robot <fengguang.wu@intel.com>
Date: Sat, 22 Jul 2017 02:54:43 +0800

> 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>

Applied to net-next.
Stephen Hemminger July 24, 2017, 11:21 p.m. UTC | #2
On Mon, 24 Jul 2017 16:20:28 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: kbuild test robot <fengguang.wu@intel.com>
> Date: Sat, 22 Jul 2017 02:54:43 +0800
> 
> > 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>  
> 
> Applied to net-next.

That function is gone in the later patches.
David Miller July 24, 2017, 11:32 p.m. UTC | #3
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Mon, 24 Jul 2017 16:21:57 -0700

> On Mon, 24 Jul 2017 16:20:28 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
> 
>> From: kbuild test robot <fengguang.wu@intel.com>
>> Date: Sat, 22 Jul 2017 02:54:43 +0800
>> 
>> > 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>  
>> 
>> Applied to net-next.
> 
> That function is gone in the later patches.

I guess I'll deal with that when I apply that series or do a merge
then :-)
diff mbox

Patch

--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -734,7 +734,7 @@  static int netvsc_set_queues(struct net_
 		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,