* [PATCH] accel/rocket: Unregister the platform device if driver registration fails
@ 2026-11-03 6:23 Wentao Liang
2026-11-03 7:11 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-11-03 6:23 UTC (permalink / raw)
To: tomeu; +Cc: heiko, ogabbay, dri-devel, linux-kernel, Wentao Liang, stable
rocket_register() registers the facade platform device before registering
the platform driver. If platform_driver_register() fails, module
initialization returns an error without unregistering the device. The
module exit function is not called after a failed initialization, so the
platform device and its resources remain registered.
Unregister the platform device when driver registration fails.
Fixes: ed98261b4168 ("accel/rocket: Add a new driver for Rockchip's NPU")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/accel/rocket/rocket_drv.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/accel/rocket/rocket_drv.c b/drivers/accel/rocket/rocket_drv.c
index 5d7805c41dc3..4ea65d6eec81 100644
--- a/drivers/accel/rocket/rocket_drv.c
+++ b/drivers/accel/rocket/rocket_drv.c
@@ -285,11 +285,17 @@ static struct platform_driver rocket_driver = {
static int __init rocket_register(void)
{
+ int ret;
+
drm_dev = platform_device_register_simple("rknn", -1, NULL, 0);
if (IS_ERR(drm_dev))
return PTR_ERR(drm_dev);
- return platform_driver_register(&rocket_driver);
+ ret = platform_driver_register(&rocket_driver);
+ if (ret)
+ platform_device_unregister(drm_dev);
+
+ return ret;
}
static void __exit rocket_unregister(void)
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] accel/rocket: Unregister the platform device if driver registration fails
2026-11-03 6:23 [PATCH] accel/rocket: Unregister the platform device if driver registration fails Wentao Liang
@ 2026-11-03 7:11 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-03 7:11 UTC (permalink / raw)
To: Wentao Liang, tomeu; +Cc: heiko, ogabbay, dri-devel, linux-kernel, stable
On 03/11/2026 07:23, Wentao Liang wrote:
> rocket_register() registers the facade platform device before registering
> the platform driver. If platform_driver_register() fails, module
> initialization returns an error without unregistering the device. The
> module exit function is not called after a failed initialization, so the
> platform device and its resources remain registered.
>
> Unregister the platform device when driver registration fails.
>
> Fixes: ed98261b4168 ("accel/rocket: Add a new driver for Rockchip's NPU")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Not even bothering to run checkpatch.
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Another fake identity of "vulab" doing exactly the same as other cases,
repeating same mistake of running unsupervised crappy bot even though
was asked multiple times to fix that.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-03 7:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 6:23 [PATCH] accel/rocket: Unregister the platform device if driver registration fails Wentao Liang
2026-11-03 7:11 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®