Input: atmel_mxt_ts - use __free() for obuf in mxt_object_show

Use the __free(kfree) macro for the obuf allocation in mxt_object_show()
to simplify the code.

Assisted-by: Gemini:gemini-3.1-pro
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20260504185448.4055973-3-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Dmitry Torokhov 2026-05-04 11:54:47 -07:00
parent 7b9b6b34a6
commit b7710233c1

View File

@ -2834,14 +2834,12 @@ static ssize_t mxt_object_show(struct device *dev,
int count = 0;
int i, j;
int error;
u8 *obuf;
/* Pre-allocate buffer large enough to hold max sized object. */
obuf = kmalloc(256, GFP_KERNEL);
u8 *obuf __free(kfree) = kmalloc(256, GFP_KERNEL);
if (!obuf)
return -ENOMEM;
error = 0;
for (i = 0; i < data->info->object_num; i++) {
object = data->object_table + i;
@ -2856,15 +2854,13 @@ static ssize_t mxt_object_show(struct device *dev,
error = __mxt_read_reg(data->client, addr, size, obuf);
if (error)
goto done;
return error;
count = mxt_show_instance(buf, count, object, j, obuf);
}
}
done:
kfree(obuf);
return error ?: count;
return count;
}
static int mxt_check_firmware_format(struct device *dev,