Merge tag 'gcc-plugins-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / watchdog / watchdog_dev.c
index 6798add..2946f3a 100644 (file)
@@ -43,8 +43,6 @@
 #include <linux/watchdog.h>    /* For watchdog specific items */
 #include <linux/uaccess.h>     /* For copy_to_user/put_user/... */
 
-#include <uapi/linux/sched/types.h>    /* For struct sched_param */
-
 #include "watchdog_core.h"
 #include "watchdog_pretimeout.h"
 
@@ -994,8 +992,10 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)
        wd_data->wdd = wdd;
        wdd->wd_data = wd_data;
 
-       if (IS_ERR_OR_NULL(watchdog_kworker))
+       if (IS_ERR_OR_NULL(watchdog_kworker)) {
+               kfree(wd_data);
                return -ENODEV;
+       }
 
        device_initialize(&wd_data->dev);
        wd_data->dev.devt = MKDEV(MAJOR(watchdog_devt), wdd->id);
@@ -1021,7 +1021,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;
                }
        }