Messages in this thread | | | Date | Sat, 11 Mar 2023 20:09:01 +0200 | From | Vladimir Oltean <> | Subject | Re: [PATCH 2/2] net: dsa: mv88e6xxx: move call to mv88e6xxx_mdios_register() |
| |
On Sat, Mar 11, 2023 at 04:19:43PM +0100, Andrew Lunn wrote: > > static int mv88e6xxx_setup(struct dsa_switch *ds) > > @@ -3889,6 +3892,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) > > int err; > > int i; > > > > + err = mv88e6xxx_mdios_register(chip); > > + if (err) > > + return err; > > + > > chip->ds = ds; > > ds->slave_mii_bus = mv88e6xxx_default_mdio_bus(chip); > > Other calls in mv88e6xxx_setup() can fail, so you need to extend the > cleanup to remove the mdio bus on failure.
FWIW, here is a snippet of how mv88e6xxx_setup() and mv88e6xxx_teardown() should look like, with error handling taken into consideration (but I was lazy and just added forward declarations, something which Klaus handled better with the movement preparatory patch): https://lore.kernel.org/lkml/20230210210804.vdyfrog5nq6hrxi5@skbuf/
| |