Source
264
264
hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, "pwmfan",
265
265
ctx, pwm_fan_groups);
266
266
if (IS_ERR(hwmon)) {
267
267
dev_err(&pdev->dev, "Failed to register hwmon device\n");
268
268
ret = PTR_ERR(hwmon);
269
269
goto err_pwm_disable;
270
270
}
271
271
272
272
ret = pwm_fan_of_get_cooling_data(&pdev->dev, ctx);
273
273
if (ret)
274
-
return ret;
274
+
goto err_pwm_disable;
275
275
276
276
ctx->pwm_fan_state = ctx->pwm_fan_max_state;
277
277
if (IS_ENABLED(CONFIG_THERMAL)) {
278
278
cdev = thermal_of_cooling_device_register(pdev->dev.of_node,
279
279
"pwm-fan", ctx,
280
280
&pwm_fan_cooling_ops);
281
281
if (IS_ERR(cdev)) {
282
282
dev_err(&pdev->dev,
283
283
"Failed to register pwm-fan as cooling device");
284
284
ret = PTR_ERR(cdev);