diff options
author | Colin Ian King <colin.i.king@gmail.com> | 2024-10-30 20:21:49 +0300 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2024-12-05 13:09:53 +0300 |
commit | 78a56df609460e8e708cb4500d624dc8a3732cfa (patch) | |
tree | 95f95f4c889f464173c874877eb196e6cad596e7 | |
parent | 40384c840ea1944d7c5a392e8975ed088ecf0b37 (diff) | |
download | linux-78a56df609460e8e708cb4500d624dc8a3732cfa.tar.xz |
mtd: phram: only call platform_driver_unregister if phram_setup fails
The check on ret and call to platform_driver_unregister is only required
in the code path where MODULE is not defined. Fix this by moving this
code into the relevant place after the call to phram_setup.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-rw-r--r-- | drivers/mtd/devices/phram.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index f756c60a4931..b8bbc7ecbe95 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c @@ -415,14 +415,14 @@ static int __init init_phram(void) return ret; #ifndef MODULE - if (phram_paramline[0]) + if (phram_paramline[0]) { ret = phram_setup(phram_paramline); + if (ret) + platform_driver_unregister(&phram_driver); + } phram_init_called = 1; #endif - if (ret) - platform_driver_unregister(&phram_driver); - return ret; } |