lkml.org 
[lkml]   [2020]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 276/408] watchdog: Use put_device on error
    Date
    From: Dinghao Liu <dinghao.liu@zju.edu.cn>

    [ Upstream commit 937425d4cd3ae4e2882b41e332bbbab616bcf0ad ]

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

    Fixes: cb36e29bb0e4b ("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>
    ---
    drivers/watchdog/watchdog_dev.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
    index 694357f2816b3..8494846ccdc5f 100644
    --- a/drivers/watchdog/watchdog_dev.c
    +++ b/drivers/watchdog/watchdog_dev.c
    @@ -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;
    }
    }
    --
    2.25.1


    \
     
     \ /
      Last update: 2020-10-27 18:33    [W:2.643 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site