From: Muhammad Mahdi Amirpour <ampr.mhd@gmail.com>
To: willy@haproxy.com, ksenija.stanojevic@gmail.com, andy@kernel.org
Cc: geert@linux-m68k.org, linux-kernel@vger.kernel.org,
Muhammad Mahdi Amirpour <ampr.mhd@gmail.com>
Subject: [PATCH] auxdisplay: panel: free logical inputs on detach
Date: Sat, 28 Nov 2026 16:17:41 +0330 [thread overview]
Message-ID: <20261128124741.76273-1-ampr.mhd@gmail.com> (raw)
Free all allocated logical inputs when the panel device is
detached or attachment fails.
Stop the scan timer before freeing the input list to prevent
the timer callback from accessing freed entries.
Reset the scan masks after releasing the inputs.
Signed-off-by: Muhammad Mahdi Amirpour <ampr.mhd@gmail.com>
---
drivers/auxdisplay/panel.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
index 2a567a075e2b..f4d279816b53 100644
--- a/drivers/auxdisplay/panel.c
+++ b/drivers/auxdisplay/panel.c
@@ -1471,6 +1471,19 @@ static void keypad_init(void)
/* device initialization */
/**************************************************/
+static void panel_free_inputs(void)
+{
+ struct logical_input *input, *tmp;
+
+ list_for_each_entry_safe(input, tmp, &logical_inputs, list) {
+ list_del(&input->list);
+ kfree(input);
+ }
+
+ scan_mask_i = 0;
+ scan_mask_o = 0;
+}
+
static void panel_attach(struct parport *port)
{
int selected_keypad_type = NOT_SET;
@@ -1615,6 +1628,10 @@ static void panel_attach(struct parport *port)
err_lcd_unreg:
if (scan_timer.function)
timer_delete_sync(&scan_timer);
+
+ keypad_initialized = 0;
+ panel_free_inputs();
+
if (lcd.enabled)
charlcd_unregister(lcd.charlcd);
err_unreg_device:
@@ -1642,6 +1659,8 @@ static void panel_detach(struct parport *port)
keypad_initialized = 0;
}
+ panel_free_inputs();
+
if (lcd.enabled) {
charlcd_unregister(lcd.charlcd);
lcd.initialized = false;
@@ -1649,7 +1668,6 @@ static void panel_detach(struct parport *port)
lcd.charlcd = NULL;
}
- /* TODO: free all input signals */
parport_release(pprt);
parport_unregister_device(pprt);
pprt = NULL;
--
2.56.0
reply other threads:[~2026-11-28 12:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261128124741.76273-1-ampr.mhd@gmail.com \
--to=ampr.mhd@gmail.com \
--cc=andy@kernel.org \
--cc=geert@linux-m68k.org \
--cc=ksenija.stanojevic@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@haproxy.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 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®