Skip to contentSkip to conversation

mtd: phram: only call platform_driver_unregister if phram_setup fails

PATCH Applied Colin Ian King 2 participants 2 messages Oct 30, 2024 – Dec 5, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/mtd/devices/phram.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/devices/phram.c +4 -4
index f756c60a4931..b8bbc7ecbe95 100644
@@ -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;
 }
 
Signature · 1 line
2.39.5
maintainer Applied
#1 lore raw

Hi,

Quoted 5 lines · Colin Ian King

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.

Applied to mtd/next.

Thanks,
Miquèl