* [PATCH] auxdisplay: panel: free logical inputs on detach
@ 2026-11-28 12:47 Muhammad Mahdi Amirpour
0 siblings, 0 replies; only message in thread
From: Muhammad Mahdi Amirpour @ 2026-11-28 12:47 UTC (permalink / raw)
To: willy, ksenija.stanojevic, andy
Cc: geert, linux-kernel, Muhammad Mahdi Amirpour
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-28 12:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-28 12:47 [PATCH] auxdisplay: panel: free logical inputs on detach Muhammad Mahdi Amirpour
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®