watchdog: f71808e_wdt: Add check for platform_driver_register
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Thu, 26 May 2022 08:03:03 +0000 (16:03 +0800)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Sat, 23 Jul 2022 12:18:46 +0000 (14:18 +0200)
As platform_driver_register() could fail, it should be better
to deal with the return value in order to maintain the code
consisitency.

Fixes: 27e0fe00a5c6 ("watchdog: f71808e_wdt: refactor to platform device/driver pair")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
https://lore.kernel.org/r/20220526080303.1005063-1-jiasheng@iscas.ac.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/f71808e_wdt.c

index 7f59c68..6a16d3d 100644 (file)
@@ -634,7 +634,9 @@ static int __init fintek_wdt_init(void)
 
        pdata.type = ret;
 
-       platform_driver_register(&fintek_wdt_driver);
+       ret = platform_driver_register(&fintek_wdt_driver);
+       if (ret)
+               return ret;
 
        wdt_res.name = "superio port";
        wdt_res.flags = IORESOURCE_IO;