diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 41b991fc3a4b9b449be8528642a19451a5f5cdd0..051a8b2edf1318003b989086addc6d0754abaed9 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4033,7 +4033,8 @@ void netdev_run_todo(void); */ static inline void dev_put(struct net_device *dev) { - this_cpu_dec(*dev->pcpu_refcnt); + if (dev) + this_cpu_dec(*dev->pcpu_refcnt); } /** @@ -4044,7 +4045,8 @@ static inline void dev_put(struct net_device *dev) */ static inline void dev_hold(struct net_device *dev) { - this_cpu_inc(*dev->pcpu_refcnt); + if (dev) + this_cpu_inc(*dev->pcpu_refcnt); } /* Carrier loss detection, dial on demand. The functions netif_carrier_on