From: Navaneeth K <knavaneeth786@gmail.com>
To: parthiban.veerasooran@microchip.com,
christian.gromm@microchip.com, gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Navaneeth K <knavaneeth786@gmail.com>
Subject: [PATCH] staging: most: dim2: fix missing cleanup on interface registration failure
Date: Sat, 22 Nov 2025 18:56:56 +0000 [thread overview]
Message-ID: <20251122185656.251902-1-knavaneeth786@gmail.com> (raw)
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
next reply other threads:[~2025-11-22 18:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-22 18:56 Navaneeth K [this message]
2025-11-25 15:16 ` [PATCH] staging: most: dim2: fix missing cleanup on interface registration failure Abdun Nihaal
2025-11-25 16:06 ` Navaneeth K
2025-11-26 11:32 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251122185656.251902-1-knavaneeth786@gmail.com \
--to=knavaneeth786@gmail.com \
--cc=christian.gromm@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=parthiban.veerasooran@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.