• Russell King's avatar
    net: fix net_device refcounting · 9861f720
    Russell King authored
    of_find_net_device_by_node() uses class_find_device() internally to
    lookup the corresponding network device.  class_find_device() returns
    a reference to the embedded struct device, with its refcount
    incremented.
    
    Add a comment to the definition in net/core/net-sysfs.c indicating the
    need to drop this refcount, and fix the DSA code to drop this refcount
    when the OF-generated platform data is cleaned up and freed.  Also
    arrange for the ref to be dropped when handling errors.
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    9861f720
net-sysfs.c 37.1 KB