Re: [PATCH] net: fsl_pq_mdio: fix oops when using uninitialized mutex
From: Andy Fleming <hidden>
Date: 2011-11-09 20:10:52
Also in:
netdev
quoted hunk ↗ jump to hunk
Fix this by moving the of_mdiobus_register() call earlier. Cc: Andy Fleming <redacted> Signed-off-by: Baruch Siach <baruch@tkos.co.il> --- =A0drivers/net/ethernet/freescale/fsl_pq_mdio.c | =A0 14 +++++++------- =A01 files changed, 7 insertions(+), 7 deletions(-)diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/e=
thernet/freescale/fsl_pq_mdio.c
quoted hunk ↗ jump to hunk
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)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tbiaddr =3D *prop;
=A0 =A0 =A0 =A0}
+ =A0 =A0 =A0 err =3D of_mdiobus_register(new_bus, np);
+ =A0 =A0 =A0 if (err) {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk (KERN_ERR "%s: Cannot register as MD=IO bus\n",
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 new_bus->na=
me);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto err_free_irqs; + =A0 =A0 =A0 } +
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.
=A0 =A0 =A0 =A0if (tbiaddr =3D=3D -1) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0out_be32(tbipa, 0);Andy