Subject: Re: [PATCH net-next v2 5/5] net: dsa: bcm_sf2: Register our slave MDIO bus

From: Vivien Didelot <[email-masked]>
Date: Tue, 07 Jun 2016 10:46:35 -0400

Hi Florian,

Florian Fainelli <[email-masked]> 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