|
|
@@ -303,8 +303,7 @@ int mlxsw_hwmon_init(struct mlxsw_core *mlxsw_core,
|
|
|
struct device *hwmon_dev;
|
|
|
int err;
|
|
|
|
|
|
- mlxsw_hwmon = devm_kzalloc(mlxsw_bus_info->dev, sizeof(*mlxsw_hwmon),
|
|
|
- GFP_KERNEL);
|
|
|
+ mlxsw_hwmon = kzalloc(sizeof(*mlxsw_hwmon), GFP_KERNEL);
|
|
|
if (!mlxsw_hwmon)
|
|
|
return -ENOMEM;
|
|
|
mlxsw_hwmon->core = mlxsw_core;
|
|
|
@@ -321,10 +320,9 @@ int mlxsw_hwmon_init(struct mlxsw_core *mlxsw_core,
|
|
|
mlxsw_hwmon->groups[0] = &mlxsw_hwmon->group;
|
|
|
mlxsw_hwmon->group.attrs = mlxsw_hwmon->attrs;
|
|
|
|
|
|
- hwmon_dev = devm_hwmon_device_register_with_groups(mlxsw_bus_info->dev,
|
|
|
- "mlxsw",
|
|
|
- mlxsw_hwmon,
|
|
|
- mlxsw_hwmon->groups);
|
|
|
+ hwmon_dev = hwmon_device_register_with_groups(mlxsw_bus_info->dev,
|
|
|
+ "mlxsw", mlxsw_hwmon,
|
|
|
+ mlxsw_hwmon->groups);
|
|
|
if (IS_ERR(hwmon_dev)) {
|
|
|
err = PTR_ERR(hwmon_dev);
|
|
|
goto err_hwmon_register;
|
|
|
@@ -337,5 +335,12 @@ int mlxsw_hwmon_init(struct mlxsw_core *mlxsw_core,
|
|
|
err_hwmon_register:
|
|
|
err_fans_init:
|
|
|
err_temp_init:
|
|
|
+ kfree(mlxsw_hwmon);
|
|
|
return err;
|
|
|
}
|
|
|
+
|
|
|
+void mlxsw_hwmon_fini(struct mlxsw_hwmon *mlxsw_hwmon)
|
|
|
+{
|
|
|
+ hwmon_device_unregister(mlxsw_hwmon->hwmon_dev);
|
|
|
+ kfree(mlxsw_hwmon);
|
|
|
+}
|