diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-09-24 20:36:13 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-09-24 23:04:52 -0700 |
commit | f018ae7a8c576345d56a0cd40d86c0574a2eb360 (patch) | |
tree | 71e460c11f9dead62f31503e1608c21cefbe0a50 /drivers/net/ethernet/freescale | |
parent | 7322967bc1bd97ac9c49ecea19e5a1f681ca27ee (diff) | |
download | op-kernel-dev-f018ae7a8c576345d56a0cd40d86c0574a2eb360.zip op-kernel-dev-f018ae7a8c576345d56a0cd40d86c0574a2eb360.tar.gz |
of_mdio: fix MDIO phy device refcounting
bus_find_device() is defined as:
* This is similar to the bus_for_each_dev() function above, but it
* returns a reference to a device that is 'found' for later use, as
* determined by the @match callback.
and it does indeed return a reference-counted pointer to the device:
while ((dev = next_device(&i)))
if (match(dev, data) && get_device(dev))
^^^^^^^^^^^^^^^
break;
klist_iter_exit(&i);
return dev;
What that means is that when we're done with the struct device, we must
drop that reference. Neither of_phy_connect() nor of_phy_attach() did
this when phy_connect_direct() or phy_attach_direct() failed.
With our previous patch, phy_connect_direct() and phy_attach_direct()
take a new refcount on the phy device when successful, so we can drop
our local reference immediatley after these functions, whether or not
they succeeded.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale')
0 files changed, 0 insertions, 0 deletions