net: fsl/fman: fix phydev reference leak
authorJohan Hovold <johan@kernel.org>
Thu, 24 Nov 2016 18:21:29 +0000 (19:21 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Nov 2016 01:01:15 +0000 (20:01 -0500)
Make sure to drop the reference taken by of_phy_find_device() during
initialisation when later freeing the struct fman_mac.

Fixes: 57ba4c9b56d8 ("fsl/fman: Add FMan MAC support")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fman/fman_memac.c

index 53ef51e3bd9ef2cb3c5f8100f807399ab36a31d1..71a5ded9d1de0fda2f08c32985cc7661a3af3966 100644 (file)
@@ -1107,6 +1107,9 @@ int memac_free(struct fman_mac *memac)
 {
        free_init_resources(memac);
 
+       if (memac->pcsphy)
+               put_device(&memac->pcsphy->mdio.dev);
+
        kfree(memac->memac_drv_param);
        kfree(memac);