[U-Boot] [PATCH 2/2] net: fec_mxc: unregister mdio bus on probe error

Eric Nelson eric at nelint.com
Tue Dec 8 17:17:44 CET 2015


Hi Mans,

On 12/08/2015 08:38 AM, Mans Rullgard wrote:
> If fecmxc_initialize_multi() fails, it frees but does not unregister
> the mdio bus, causing subsequent uses of the "mii" command to crash.
> Fix this by adding mdio_unregister() calls where needed.
> 
> Signed-off-by: Mans Rullgard <mans at mansr.com>
> ---
>  drivers/net/fec_mxc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index 1250d2a..6c5e80b 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -1109,6 +1109,7 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
>  #ifdef CONFIG_PHYLIB
>  	phydev = phy_find_by_mask(bus, 1 << phy_id, PHY_INTERFACE_MODE_RGMII);
>  	if (!phydev) {
> +		mdio_unregister(bus);

While you're in here, this should probably be mdio_free just
to prevent somebody else from searching as I did.

>  		free(bus);
>  		return -ENOMEM;
>  	}
> @@ -1120,6 +1121,7 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
>  #ifdef CONFIG_PHYLIB
>  		free(phydev);
>  #endif
> +		mdio_unregister(bus);

Ditto:
>  		free(bus);
>  	}
>  	return ret;
> 

Otherwise,

Reviewed-by: Eric Nelson <eric at nelint.com>



More information about the U-Boot mailing list