Hi Benjamin,
On Mon, May 04, 2026 at 10:47:25AM +0200, Benjamin Tissoires wrote:
@@ -386,10 +381,11 @@ static void wacom_feature_mapping(struct hid_device *hdev, case WACOM_HID_WD_OFFSETRIGHT: case WACOM_HID_WD_OFFSETBOTTOM: /* read manually */
n = hid_report_len(field->report);data = hid_alloc_report_buf(field->report, GFP_KERNEL);
u8 *data __free(kfree) = hid_alloc_report_buf(field->report, GFP_KERNEL);- if (!data) break;
data[0] = field->report->id; ret = wacom_get_report(hdev, HID_FEATURE_REPORT, data, n, WAC_CMD_RETRIES);n = hid_report_len(field->report);@@ -400,7 +396,6 @@ static void wacom_feature_mapping(struct hid_device *hdev, hid_warn(hdev, "%s: could not retrieve sensor offsets\n", __func__); }
break; }kfree(data);
I'd recommend establishing a new scope for the "data", otherwise it is fragile. If there was another label below then this cleanup would explode since current scope of "data" is from the declaration point until the end of the switch statement.
Having a dedicated scope makes lifertime explicit.
Thanks.