Skip to content

Commit e96b293

Browse files
Csókás, Bencekuba-moo
authored andcommitted
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: d2e816c ("net: sfp: handle module remove outside state machine") Signed-off-by: "Csókás, Bence" <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d30d0e4 commit e96b293

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/phy/sfp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,8 +2429,7 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
24292429

24302430
/* Handle remove event globally, it resets this state machine */
24312431
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);
24342433
sfp_sm_mod_next(sfp, SFP_MOD_EMPTY, 0);
24352434
return;
24362435
}

0 commit comments

Comments
 (0)