linux/drivers/net/dsa
Vladimir Oltean 0d120dfb5d net: dsa: lantiq_gswip: don't use devres for mdiobus
As explained in commits:
74b6d7d133 ("net: dsa: realtek: register the MDIO bus under devres")
5135e96a3d ("net: dsa: don't allocate the slave_mii_bus using devres")

mdiobus_free() will panic when called from devm_mdiobus_free() <-
devres_release_all() <- __device_release_driver(), and that mdiobus was
not previously unregistered.

The GSWIP switch is a platform device, so the initial set of constraints
that I thought would cause this (I2C or SPI buses which call ->remove on
->shutdown) do not apply. But there is one more which applies here.

If the DSA master itself is on a bus that calls ->remove from ->shutdown
(like dpaa2-eth, which is on the fsl-mc bus), there is a device link
between the switch and the DSA master, and device_links_unbind_consumers()
will unbind the GSWIP switch driver on shutdown.

So the same treatment must be applied to all DSA switch drivers, which
is: either use devres for both the mdiobus allocation and registration,
or don't use devres at all.

The gswip driver has the code structure in place for orderly mdiobus
removal, so just replace devm_mdiobus_alloc() with the non-devres
variant, and add manual free where necessary, to ensure that we don't
let devres free a still-registered bus.

Fixes: ac3a68d566 ("net: phy: don't abuse devres in devm_mdiobus_register()")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-02-08 20:30:36 -08:00
..
b53 net: dsa: add a "tx_fwd_offload" argument to ->port_bridge_join 2021-12-08 14:31:16 -08:00
hirschmann net: dsa: hellcreek: Add missing PTP via UDP rules 2021-12-14 18:46:29 -08:00
microchip Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-12-31 14:35:40 +00:00
mv88e6xxx net: dsa: mv88e6xxx: don't use devres for mdiobus 2022-02-08 20:30:33 -08:00
ocelot net: dsa: seville: register the mdiobus under devres 2022-02-08 20:30:35 -08:00
qca net: dsa: ar9331: register the mdiobus under devres 2022-02-08 20:30:34 -08:00
sja1105 flow_offload: add index to flow_action_entry structure 2021-12-19 14:08:47 +00:00
xrs700x net: Don't include filter.h from net/sock.h 2021-12-29 08:48:14 -08:00
bcm_sf2_cfp.c
bcm_sf2_regs.h net: dsa: bcm_sf2: refactor LED regs access 2021-12-30 17:28:32 -08:00
bcm_sf2.c net: dsa: bcm_sf2: don't use devres for mdiobus 2022-02-08 20:30:34 -08:00
bcm_sf2.h net: dsa: bcm_sf2: refactor LED regs access 2021-12-30 17:28:32 -08:00
dsa_loop_bdinfo.c
dsa_loop.c net: dsa: add a "tx_fwd_offload" argument to ->port_bridge_join 2021-12-08 14:31:16 -08:00
dsa_loop.h
Kconfig net: dsa: mt7530: make NET_DSA_MT7530 select MEDIATEK_GE_PHY 2022-01-31 21:18:17 -08:00
lan9303_i2c.c
lan9303_mdio.c
lan9303-core.c net: dsa: add a "tx_fwd_offload" argument to ->port_bridge_join 2021-12-08 14:31:16 -08:00
lan9303.h
lantiq_gswip.c net: dsa: lantiq_gswip: don't use devres for mdiobus 2022-02-08 20:30:36 -08:00
lantiq_pce.h
Makefile
mt7530.c net: dsa: mt7530: fix kernel bug in mdiobus_free() when unbinding 2022-02-08 20:30:35 -08:00
mt7530.h
mv88e6060.c
mv88e6060.h
qca8k.c net: dsa: add a "tx_fwd_offload" argument to ->port_bridge_join 2021-12-08 14:31:16 -08:00
qca8k.h net: dsa: qca8k: add LAG support 2021-11-23 11:53:16 +00:00
realtek-smi-core.c net: dsa: realtek-smi: don't log an error on EPROBE_DEFER 2021-11-29 12:51:37 +00:00
realtek-smi-core.h
rtl8365mb.c net: dsa: rtl8365mb: add GMII as user port mode 2021-12-16 10:51:11 +00:00
rtl8366.c
rtl8366rb.c net: dsa: add a "tx_fwd_offload" argument to ->port_bridge_join 2021-12-08 14:31:16 -08:00
vitesse-vsc73xx-core.c net: dsa: vsc73xxx: Get rid of duplicate of_node assignment 2021-12-03 14:13:02 +00:00
vitesse-vsc73xx-platform.c
vitesse-vsc73xx-spi.c
vitesse-vsc73xx.h net: dsa: vsc73xxx: Make vsc73xx_remove() return void 2021-11-15 13:15:07 +00:00