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

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.cn


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 5afb6d20
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
		}
	}