]> Git Repo - linux.git/commitdiff
staging: fbtft: Fix error path in fbtft_driver_module_init()
authorUwe Kleine-König <[email protected]>
Tue, 18 Jan 2022 18:13:37 +0000 (19:13 +0100)
committerGreg Kroah-Hartman <[email protected]>
Tue, 25 Jan 2022 15:36:49 +0000 (16:36 +0100)
If registering the platform driver fails, the function must not return
without undoing the spi driver registration first.

Fixes: c296d5f9957c ("staging: fbtft: core support")
Signed-off-by: Uwe Kleine-König <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/staging/fbtft/fbtft.h

index 4cdec34e23d2ebb7bd7e1c36b195e8e9d7263ca8..55677efc01380a78f576be27af41a9825bc2279c 100644 (file)
@@ -334,7 +334,10 @@ static int __init fbtft_driver_module_init(void)                           \
        ret = spi_register_driver(&fbtft_driver_spi_driver);               \
        if (ret < 0)                                                       \
                return ret;                                                \
-       return platform_driver_register(&fbtft_driver_platform_driver);    \
+       ret = platform_driver_register(&fbtft_driver_platform_driver);     \
+       if (ret < 0)                                                       \
+               spi_unregister_driver(&fbtft_driver_spi_driver);           \
+       return ret;                                                        \
 }                                                                          \
                                                                           \
 static void __exit fbtft_driver_module_exit(void)                          \
This page took 0.048822 seconds and 4 git commands to generate.