public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: most: dim2: fix missing cleanup on interface registration failure
@ 2025-11-22 18:56 Navaneeth K
  2025-11-25 15:16 ` Abdun Nihaal
  0 siblings, 1 reply; 4+ messages in thread
From: Navaneeth K @ 2025-11-22 18:56 UTC (permalink / raw)
  To: parthiban.veerasooran, christian.gromm, gregkh
  Cc: linux-staging, linux-kernel, Navaneeth K

If most_register_interface() fails, the function returned immediately
without freeing the allocated 'dev' structure or resetting the hardware
state via dim_shutdown().

Add a proper error path that jumps to the existing error handling label
to ensure resources are freed and the hardware is shut down correctly.

Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
---
 drivers/staging/most/dim2/dim2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index dad2abe6c0c9..ddf86d794448 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -889,7 +889,11 @@ static int dim2_probe(struct platform_device *pdev)
 	dev->dev.parent = &pdev->dev;
 	dev->dev.release = dim2_release;
 
-	return most_register_interface(&dev->most_iface);
+	ret = most_register_interface(&dev->most_iface);
+	if (ret)
+		goto err_shutdown_dim;
+
+	return 0;
 
 err_shutdown_dim:
 	dim_shutdown();
-- 
2.43.0


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

end of thread, other threads:[~2025-11-26 11:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-22 18:56 [PATCH] staging: most: dim2: fix missing cleanup on interface registration failure Navaneeth K
2025-11-25 15:16 ` Abdun Nihaal
2025-11-25 16:06   ` Navaneeth K
2025-11-26 11:32     ` Greg KH

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