[PATCH] Input: amijoy - fix memory region leak on registration failure
From: Thorsten Blum
Date: Sat Nov 07 2026 - 11:11:07 EST
If input_register_device() fails in amijoy_init(), release the memory
region for port i before cleaning up the previously registered ports.
Fixes: 127278ce2254 ("Input: joysticks - handle errors when registering input devices")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
---
drivers/input/joystick/amijoy.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
index cdb2b8f15348..3c2357ba7dc3 100644
--- a/drivers/input/joystick/amijoy.c
+++ b/drivers/input/joystick/amijoy.c
@@ -132,6 +132,7 @@ static int __init amijoy_init(void)
err = input_register_device(amijoy_dev[i]);
if (err) {
input_free_device(amijoy_dev[i]);
+ release_mem_region(CUSTOM_PHYSADDR + 10 + i * 2, 2);
goto fail;
}
}