diff --git a/include/net/netdev_lock.h b/include/net/netdev_lock.h index 5706835a660c..270e157a4a79 100644 --- a/include/net/netdev_lock.h +++ b/include/net/netdev_lock.h @@ -30,7 +30,8 @@ static inline bool netdev_need_ops_lock(const struct net_device *dev) bool ret = dev->request_ops_lock || !!dev->queue_mgmt_ops; #if IS_ENABLED(CONFIG_NET_SHAPER) - ret |= !!dev->netdev_ops->net_shaper_ops; + if (dev->netdev_ops) + ret |= !!dev->netdev_ops->net_shaper_ops; #endif return ret;