Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: sfp: Always call `sfp_sm_mod_remove()` on remove

If the module is in SFP_MOD_ERROR, `sfp_sm_mod_remove()` will
not be run. As a consequence, `sfp_hwmon_remove()` is not getting
run either, leaving a stale `hwmon` device behind. `sfp_sm_mod_remove()`
itself checks `sfp->sm_mod_state` anyways, so this check was not
really needed in the first place.

Fixes: d2e816c0293f ("net: sfp: handle module remove outside state machine")
Signed-off-by: "Csókás, Bence" <csokas.bence@prolan.hu>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20240605084251.63502-1-csokas.bence@prolan.hu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Csókás, Bence and committed by
Jakub Kicinski
e96b2933 d30d0e49

+1 -2
+1 -2
drivers/net/phy/sfp.c
··· 2429 2429 2430 2430 /* Handle remove event globally, it resets this state machine */ 2431 2431 if (event == SFP_E_REMOVE) { 2432 - if (sfp->sm_mod_state > SFP_MOD_PROBE) 2433 - sfp_sm_mod_remove(sfp); 2432 + sfp_sm_mod_remove(sfp); 2434 2433 sfp_sm_mod_next(sfp, SFP_MOD_EMPTY, 0); 2435 2434 return; 2436 2435 }