Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: Check dev_set_name() return value

It's possible that dev_set_name() returns -ENOMEM, catch and handle this.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220920020312.2383-1-liubo03@inspur.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Bo Liu and committed by
Wim Van Sebroeck
0e012972 ec122fd9

+5 -1
+5 -1
drivers/watchdog/watchdog_dev.c
··· 1015 1015 wd_data->dev.groups = wdd->groups; 1016 1016 wd_data->dev.release = watchdog_core_data_release; 1017 1017 dev_set_drvdata(&wd_data->dev, wdd); 1018 - dev_set_name(&wd_data->dev, "watchdog%d", wdd->id); 1018 + err = dev_set_name(&wd_data->dev, "watchdog%d", wdd->id); 1019 + if (err) { 1020 + put_device(&wd_data->dev); 1021 + return err; 1022 + } 1019 1023 1020 1024 kthread_init_work(&wd_data->work, watchdog_ping_work); 1021 1025 hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);