mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
net: sysfs: Fix weird usage of class's namespace relevant fields
Device class has two namespace relevant fields which are associated by the following usage: struct class { ... const struct kobj_ns_type_operations *ns_type; const void *(*namespace)(const struct device *dev); ... } if (dev->class && dev->class->ns_type) dev->class->namespace(dev); The usage looks weird since it checks @ns_type but calls namespace() it is found for all existing class definitions that the other filed is also assigned once one is assigned in current kernel tree, so fix this weird usage by checking @namespace to call namespace(). Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4897313bdb
commit
8f08854199
1 changed files with 2 additions and 2 deletions
|
@ -1060,7 +1060,7 @@ static const void *rx_queue_namespace(const struct kobject *kobj)
|
|||
struct device *dev = &queue->dev->dev;
|
||||
const void *ns = NULL;
|
||||
|
||||
if (dev->class && dev->class->ns_type)
|
||||
if (dev->class && dev->class->namespace)
|
||||
ns = dev->class->namespace(dev);
|
||||
|
||||
return ns;
|
||||
|
@ -1744,7 +1744,7 @@ static const void *netdev_queue_namespace(const struct kobject *kobj)
|
|||
struct device *dev = &queue->dev->dev;
|
||||
const void *ns = NULL;
|
||||
|
||||
if (dev->class && dev->class->ns_type)
|
||||
if (dev->class && dev->class->namespace)
|
||||
ns = dev->class->namespace(dev);
|
||||
|
||||
return ns;
|
||||
|
|
Loading…
Add table
Reference in a new issue