aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/sfp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/sfp.c')
-rw-r--r--drivers/net/phy/sfp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 52fffb98fde9..6e13b8832bc7 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -1098,8 +1098,11 @@ static int sfp_hwmon_insert(struct sfp *sfp)
1098 1098
1099static void sfp_hwmon_remove(struct sfp *sfp) 1099static void sfp_hwmon_remove(struct sfp *sfp)
1100{ 1100{
1101 hwmon_device_unregister(sfp->hwmon_dev); 1101 if (!IS_ERR_OR_NULL(sfp->hwmon_dev)) {
1102 kfree(sfp->hwmon_name); 1102 hwmon_device_unregister(sfp->hwmon_dev);
1103 sfp->hwmon_dev = NULL;
1104 kfree(sfp->hwmon_name);
1105 }
1103} 1106}
1104#else 1107#else
1105static int sfp_hwmon_insert(struct sfp *sfp) 1108static int sfp_hwmon_insert(struct sfp *sfp)