Commit 78a56df6 authored by Colin Ian King's avatar Colin Ian King Committed by Miquel Raynal
Browse files

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: default avatarColin Ian King <colin.i.king@gmail.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 40384c84
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -415,13 +415,13 @@ static int __init init_phram(void)
		return ret;

#ifndef MODULE
	if (phram_paramline[0])
	if (phram_paramline[0]) {
		ret = phram_setup(phram_paramline);
	phram_init_called = 1;
#endif

		if (ret)
			platform_driver_unregister(&phram_driver);
	}
	phram_init_called = 1;
#endif

	return ret;
}