Commit 937425d4 authored by Dinghao Liu's avatar Dinghao Liu Committed by Wim Van Sebroeck

watchdog: Use put_device on error

We should use put_device() instead of freeing device
directly after device_initialize().

Fixes: cb36e29b ("watchdog: initialize device before misc_register")
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20200824031230.31050-1-dinghao.liu@zju.edu.cnSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 5afb6d20
......@@ -1023,7 +1023,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)
pr_err("%s: a legacy watchdog module is probably present.\n",
wdd->info->identity);
old_wd_data = NULL;
kfree(wd_data);
put_device(&wd_data->dev);
return err;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment