struct scarlett2_usb_packet *req __free(kfree) = NULL;
size_t req_buf_size = struct_size(req, data, req_size);
- req = kmalloc(req_buf_size, GFP_KERNEL);
+ req = kmalloc_flex(*req, data, req_size);
if (!req)
return -ENOMEM;
struct scarlett2_usb_packet *resp __free(kfree) = NULL;
size_t resp_buf_size = struct_size(resp, data, resp_size);
- resp = kmalloc(resp_buf_size, GFP_KERNEL);
+ resp = kmalloc_flex(*resp, data, resp_size);
if (!resp)
return -ENOMEM;
u8 data[];
} __packed *req;
int err;
- int buf_size = struct_size(req, data, bytes);
+ size_t buf_size = struct_size(req, data, bytes);
- req = kmalloc(buf_size, GFP_KERNEL);
+ req = kmalloc_flex(*req, data, bytes);
if (!req)
return -ENOMEM;
/* Create and send the request */
len = struct_size(req, data, count);
- req = kzalloc(len, GFP_KERNEL);
+ req = kzalloc_flex(*req, data, count);
if (!req)
return -ENOMEM;