phy: fix of_mdio_find_bus() device refcount leak
authorRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 24 Sep 2015 19:35:52 +0000 (20:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Sep 2015 06:04:52 +0000 (23:04 -0700)
commita136442131443d929d2d8d243157824de4dfbae8
tree1a6e439b37d344366bd275e157ac11b867e89f36
parent17a10c9215b39a5ea8faeb241759c1aee6553919
phy: fix of_mdio_find_bus() device refcount leak

of_mdio_find_bus() leaks a struct device refcount, caused by using
class_find_device() and not realising that the device reference has
its refcount incremented:

 * Note, you will need to drop the reference with put_device() after use.
...
        while ((dev = class_dev_iter_next(&iter))) {
                if (match(dev, data)) {
                        get_device(dev);
                        break;
                }

Update the comment, and arrange for the phy code to drop this refcount
when disposing of a reference to it.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mdio-mux.c
drivers/net/phy/mdio_bus.c