diff options
| author | Jinmo Yang <jinmo44.yang@gmail.com> | 2026-06-01 22:41:24 +0900 |
|---|---|---|
| committer | Benjamin Tissoires <bentiss@kernel.org> | 2026-06-01 18:39:07 +0200 |
| commit | cb605d48dac95b3b1258c2dcdd2d2c3617bee092 (patch) | |
| tree | afcf7884780b6e28cebe3c18ffa4921e1c736a47 | |
| parent | 55f1ad573e34abf9a0443c34bc5a63d74edba7d7 (diff) | |
HID: wacom: use cleanup.h for wacom_wac_queue_flush() buffer management
Use __free(kfree) cleanup facility for the temporary buffer in
wacom_wac_queue_flush() to simplify error paths and ensure the buffer
is freed automatically when it goes out of scope.
Signed-off-by: Jinmo Yang <jinmo44.yang@gmail.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
| -rw-r--r-- | drivers/hid/wacom_sys.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 3a06be1e163a..3e3bcf695296 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -72,11 +72,10 @@ static void wacom_wac_queue_flush(struct hid_device *hdev, { while (!kfifo_is_empty(fifo)) { int size = kfifo_peek_len(fifo); - u8 *buf; + u8 *buf __free(kfree) = kzalloc(size, GFP_ATOMIC); unsigned int count; int err; - buf = kzalloc(size, GFP_ATOMIC); if (!buf) { kfifo_skip(fifo); continue; @@ -89,7 +88,6 @@ static void wacom_wac_queue_flush(struct hid_device *hdev, // to flush seems reasonable enough, however. hid_warn(hdev, "%s: removed fifo entry with unexpected size\n", __func__); - kfree(buf); continue; } err = hid_report_raw_event(hdev, HID_INPUT_REPORT, buf, size, size, false); @@ -97,8 +95,6 @@ static void wacom_wac_queue_flush(struct hid_device *hdev, hid_warn(hdev, "%s: unable to flush event due to error %d\n", __func__, err); } - - kfree(buf); } } |
