[PATCH] net: fsl_pq_mdio: fix oops when using uninitialized mutex

Andy Fleming afleming at gmail.com
Thu Nov 10 07:10:49 EST 2011


> Fix this by moving the of_mdiobus_register() call earlier.
>
> Cc: Andy Fleming <afleming at freescale.com>
> Signed-off-by: Baruch Siach <baruch at tkos.co.il>
> ---
>  drivers/net/ethernet/freescale/fsl_pq_mdio.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
> index 52f4e8a..e17fd2f 100644
> --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
> +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
> @@ -385,6 +385,13 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev)
>                        tbiaddr = *prop;
>        }
>
> +       err = of_mdiobus_register(new_bus, np);
> +       if (err) {
> +               printk (KERN_ERR "%s: Cannot register as MDIO bus\n",
> +                               new_bus->name);
> +               goto err_free_irqs;
> +       }
> +


This fix totally breaks the point of setting tbipa beforehand.
mdiobus_register will cause the bus to be scanned, and if any of the
PHYs are at the default address for tbipa, they won't be found. I have
a different fix which I will (re)submit today.


>        if (tbiaddr == -1) {
>                out_be32(tbipa, 0);


Andy


More information about the Linuxppc-dev mailing list