Re: [v3] HID: corsair-void: Add Corsair Void headset family driver

From: Markus Elfring
Date: Wed Aug 21 2024 - 04:37:31 EST


>> +static ssize_t send_alert_store(struct device *dev,
>> +                struct device_attribute *attr,
>> +                const char *buf, size_t count)
>> +{

>> +    unsigned char *send_buf __free(kfree) = NULL;

>> +    send_buf = kmalloc(3, GFP_KERNEL);

>> +    ret = hid_hw_raw_request(hid_dev, CORSAIR_VOID_NOTIF_REQUEST_ID,
>> +                 send_buf, 3, HID_OUTPUT_REPORT,
>> +                 HID_REQ_SET_REPORT);

> I'm not familiar with the hid_hw_raw_request() API, but I think that a kfree(send_buf) is missing here.

* Please take another look at the usage of scope-based resource management.

* Would you eventually prefer any other programming interfaces here?


Regards,
Markus