diff options
| author | Johan Hovold <johan@kernel.org> | 2016-11-16 09:20:37 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-11-17 12:05:04 -0500 |
| commit | 3ae30f4ce65e9d4de274b1472169ab3c27f5c666 (patch) | |
| tree | 9e65dc4f80eb0f1a69eff5e556e72ff883992fa7 /drivers/of | |
| parent | 48c1699d5335bc045b50989a06b1c526b17a25ff (diff) | |
of_mdio: fix device reference leak in of_phy_find_device
Make sure to drop the reference taken by bus_find_device() before
returning NULL from of_phy_find_device() when the found device is not a
PHY.
Fixes: 6ed742363b9c ("of: of_mdio: Ensure mdio device is a PHY")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/of')
| -rw-r--r-- | drivers/of/of_mdio.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 8f4648383fb2..5a3145a02547 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
| @@ -292,6 +292,7 @@ struct phy_device *of_phy_find_device(struct device_node *phy_np) | |||
| 292 | mdiodev = to_mdio_device(d); | 292 | mdiodev = to_mdio_device(d); |
| 293 | if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) | 293 | if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) |
| 294 | return to_phy_device(d); | 294 | return to_phy_device(d); |
| 295 | put_device(d); | ||
| 295 | } | 296 | } |
| 296 | 297 | ||
| 297 | return NULL; | 298 | return NULL; |
