public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] mtd: phram: only call platform_driver_unregister if phram_setup fails
@ 2024-10-30 17:21 Colin Ian King
  2024-12-05 10:46 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2024-10-30 17:21 UTC (permalink / raw)
  To: Joern Engel, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd
  Cc: kernel-janitors, linux-kernel

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>
---
 drivers/mtd/devices/phram.c | 8 ++++----
 1 file 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;
 }
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] mtd: phram: only call platform_driver_unregister if phram_setup fails
  2024-10-30 17:21 [PATCH][next] mtd: phram: only call platform_driver_unregister if phram_setup fails Colin Ian King
@ 2024-12-05 10:46 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2024-12-05 10:46 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Joern Engel, Richard Weinberger, Vignesh Raghavendra, linux-mtd,
	kernel-janitors, linux-kernel

Hi,

On 30/10/2024 at 17:21:49 GMT, Colin Ian King <colin.i.king@gmail.com> wrote:

> 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>

Applied to mtd/next.

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-05 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30 17:21 [PATCH][next] mtd: phram: only call platform_driver_unregister if phram_setup fails Colin Ian King
2024-12-05 10:46 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox