1
0
Fork 0

net: sfp: fix hwmon

The referenced commit below allowed more than one hwmon device to be
created per SFP, which is definitely not what we want. Avoid this by
only creating the hwmon device just as we transition to WAITDEV state.

Fixes: 139d3a212a ("net: sfp: allow modules with slow diagnostics to probe")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
alistair/sunxi64-5.5-dsi
Russell King 2019-12-03 23:51:28 +00:00 committed by David S. Miller
parent 0cb96b5749
commit 38ecd706ca
1 changed files with 4 additions and 9 deletions

View File

@ -1754,6 +1754,10 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
break;
}
err = sfp_hwmon_insert(sfp);
if (err)
dev_warn(sfp->dev, "hwmon probe failed: %d\n", err);
sfp_sm_mod_next(sfp, SFP_MOD_WAITDEV, 0);
/* fall through */
case SFP_MOD_WAITDEV:
@ -1803,15 +1807,6 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
case SFP_MOD_ERROR:
break;
}
#if IS_ENABLED(CONFIG_HWMON)
if (sfp->sm_mod_state >= SFP_MOD_WAITDEV &&
IS_ERR_OR_NULL(sfp->hwmon_dev)) {
err = sfp_hwmon_insert(sfp);
if (err)
dev_warn(sfp->dev, "hwmon probe failed: %d\n", err);
}
#endif
}
static void sfp_sm_main(struct sfp *sfp, unsigned int event)