Commit 0e012972 authored by Bo Liu's avatar Bo Liu Committed by Wim Van Sebroeck

watchdog: Check dev_set_name() return value

It's possible that dev_set_name() returns -ENOMEM, catch and handle this.
Signed-off-by: default avatarBo Liu <liubo03@inspur.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220920020312.2383-1-liubo03@inspur.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent ec122fd9
...@@ -1015,7 +1015,11 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) ...@@ -1015,7 +1015,11 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)
wd_data->dev.groups = wdd->groups; wd_data->dev.groups = wdd->groups;
wd_data->dev.release = watchdog_core_data_release; wd_data->dev.release = watchdog_core_data_release;
dev_set_drvdata(&wd_data->dev, wdd); dev_set_drvdata(&wd_data->dev, wdd);
dev_set_name(&wd_data->dev, "watchdog%d", wdd->id); err = dev_set_name(&wd_data->dev, "watchdog%d", wdd->id);
if (err) {
put_device(&wd_data->dev);
return err;
}
kthread_init_work(&wd_data->work, watchdog_ping_work); kthread_init_work(&wd_data->work, watchdog_ping_work);
hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
......
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