linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()
@ 2022-11-23  9:42 Yuan Can
  2022-12-05 21:13 ` Jernej Škrabec
  2023-01-08 20:35 ` Jernej Škrabec
  0 siblings, 2 replies; 3+ messages in thread
From: Yuan Can @ 2022-11-23  9:42 UTC (permalink / raw)
  To: wens, jernej.skrabec, samuel, gregkh, christophe.jaillet, tglx,
	arnd, mripard, broonie, olof, linux-arm-kernel, linux-sunxi
  Cc: yuancan

The sunxi_rsb_init() returns the platform_driver_register() directly
without checking its return value, if platform_driver_register() failed,
the sunxi_rsb_bus is not unregistered.
Fix by unregister sunxi_rsb_bus when platform_driver_register() failed.

Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/bus/sunxi-rsb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index 4cd2e127946e..87b10011667c 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -853,7 +853,13 @@ static int __init sunxi_rsb_init(void)
 		return ret;
 	}
 
-	return platform_driver_register(&sunxi_rsb_driver);
+	ret = platform_driver_register(&sunxi_rsb_driver);
+	if (ret) {
+		bus_unregister(&sunxi_rsb_bus);
+		return ret;
+	}
+
+	return 0;
 }
 module_init(sunxi_rsb_init);
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()
  2022-11-23  9:42 [PATCH] bus: sunxi-rsb: Fix error handling in sunxi_rsb_init() Yuan Can
@ 2022-12-05 21:13 ` Jernej Škrabec
  2023-01-08 20:35 ` Jernej Škrabec
  1 sibling, 0 replies; 3+ messages in thread
From: Jernej Škrabec @ 2022-12-05 21:13 UTC (permalink / raw)
  To: wens, samuel, gregkh, christophe.jaillet, tglx, arnd, mripard,
	broonie, olof, linux-arm-kernel, linux-sunxi, Yuan Can
  Cc: yuancan

Dne sreda, 23. november 2022 ob 10:42:00 CET je Yuan Can napisal(a):
> The sunxi_rsb_init() returns the platform_driver_register() directly
> without checking its return value, if platform_driver_register() failed,
> the sunxi_rsb_bus is not unregistered.
> Fix by unregister sunxi_rsb_bus when platform_driver_register() failed.
> 
> Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced
> Serial Bus") Signed-off-by: Yuan Can <yuancan@huawei.com>

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()
  2022-11-23  9:42 [PATCH] bus: sunxi-rsb: Fix error handling in sunxi_rsb_init() Yuan Can
  2022-12-05 21:13 ` Jernej Škrabec
@ 2023-01-08 20:35 ` Jernej Škrabec
  1 sibling, 0 replies; 3+ messages in thread
From: Jernej Škrabec @ 2023-01-08 20:35 UTC (permalink / raw)
  To: wens, samuel, gregkh, christophe.jaillet, tglx, arnd, mripard,
	broonie, olof, linux-arm-kernel, linux-sunxi, Yuan Can
  Cc: yuancan

Dne sreda, 23. november 2022 ob 10:42:00 CET je Yuan Can napisal(a):
> The sunxi_rsb_init() returns the platform_driver_register() directly
> without checking its return value, if platform_driver_register() failed,
> the sunxi_rsb_bus is not unregistered.
> Fix by unregister sunxi_rsb_bus when platform_driver_register() failed.
> 
> Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced
> Serial Bus") Signed-off-by: Yuan Can <yuancan@huawei.com>

Applied, thanks!

Best regards,
Jernej



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-01-08 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23  9:42 [PATCH] bus: sunxi-rsb: Fix error handling in sunxi_rsb_init() Yuan Can
2022-12-05 21:13 ` Jernej Škrabec
2023-01-08 20:35 ` Jernej Škrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).