Hi Florian,

Florian Fainelli <f.faine...@gmail.com> writes:

>  static int bcm_sf2_sw_setup(struct dsa_switch *ds)
>  {
>       const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME;
> @@ -972,6 +1099,12 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
>               goto out_unmap;
>       }
>  
> +     ret = bcm_sf2_mdio_register(ds);
> +     if (ret) {
> +             pr_err("failed to register MDIO bus\n");
> +             goto out_unmap;
> +     }
> +
>       /* Disable all interrupts and request them */
>       bcm_sf2_intr_disable(priv);

Hum reviewing that again, I see that if one of the 2 subsequent calls to
request_irq fails, you end up with an unregistered MDIO bus.

We have the same issue in the mv88e6xxx legacy probe code if dsa.c fails
to allocate the dsa_switch structure. I'm moving the MDIO register code
to the setup function like you are doing here (good idea!) to fix that.

Thanks,

        Vivien

Reply via email to