1
0
Fork 0

watchdog: Use put_device on error

[ Upstream commit 937425d4cd ]

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

Fixes: cb36e29bb0 ("watchdog: initialize device before misc_register")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20200824031230.31050-1-dinghao.liu@zju.edu.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Dinghao Liu 2020-08-24 11:12:30 +08:00 committed by Greg Kroah-Hartman
parent a8bbb47d94
commit dbb9ef1777
1 changed files with 1 additions and 1 deletions

View File

@ -1000,7 +1000,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;
}
}