diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2022-01-18 19:13:37 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-25 16:36:49 +0100 |
commit | 426aca16e903b387a0b0001d62207a745c67cfd3 (patch) | |
tree | 817dcbf8a42483d679410c396aa5f0ed0649afc3 /drivers | |
parent | 0cea730cac824edf78ffd3302938ed5fe2b9d50d (diff) | |
download | linux-stable-426aca16e903b387a0b0001d62207a745c67cfd3.tar.gz linux-stable-426aca16e903b387a0b0001d62207a745c67cfd3.tar.bz2 linux-stable-426aca16e903b387a0b0001d62207a745c67cfd3.zip |
staging: fbtft: Fix error path in fbtft_driver_module_init()
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 <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220118181338.207943-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/fbtft/fbtft.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 4cdec34e23d2..55677efc0138 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -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) \ |