Commit e96b2933 authored by Bence Csókás's avatar Bence Csókás Committed by Jakub Kicinski
Browse files

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: d2e816c0 ("net: sfp: handle module remove outside state machine")
Signed-off-by: default avatar"Csókás, Bence" <csokas.bence@prolan.hu>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20240605084251.63502-1-csokas.bence@prolan.hu


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d30d0e49
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2429,7 +2429,6 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)

	/* Handle remove event globally, it resets this state machine */
	if (event == SFP_E_REMOVE) {
		if (sfp->sm_mod_state > SFP_MOD_PROBE)
		sfp_sm_mod_remove(sfp);
		sfp_sm_mod_next(sfp, SFP_MOD_EMPTY, 0);
		return;