Re: [PATCH v2] HID: Input: Add battery list cleanup with devm action

From: Lucas Zampieri

Date: Mon Jun 01 2026 - 23:45:18 EST


Hi Rafael,

Thanks for catching this and the quick fix. Turns out this is the
hidinput_cleanup_battery() hunk we dropped in the devm conversion
(patch 1/3), figuring devm would handle the cleanup. It frees the
hid_battery structs fine, but never unlinks them from hdev->batteries,
which outlives the devm scope, so the list dangles into freed memory on
the next probe. My bad.

Acked-by: Lucas Zampieri <lcasmz54@xxxxxxxxx>