mdio-sun4i: Fix a memory leak
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 6 Jan 2018 08:00:09 +0000 (09:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Mar 2018 09:24:36 +0000 (10:24 +0100)
commitf5ac846ba15f8fc96c867e6e13b85d12b8b65515
tree2367c03a5940ac648e5ed701cc7f89fea7665ee6
parent84ada11975b7fd200f5ca6e263c8060ca4d636d9
mdio-sun4i: Fix a memory leak

[ Upstream commit 56c0290202ab94a2f2780c449395d4ae8495fab4 ]

If the probing of the regulator is deferred, the memory allocated by
'mdiobus_alloc_size()' will be leaking.
It should be freed before the next call to 'sun4i_mdio_probe()' which will
reallocate it.

Fixes: 4bdcb1dd9feb ("net: Add MDIO bus driver for the Allwinner EMAC")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/phy/mdio-sun4i.c