From: Denis Benato Date: Sat, 28 Feb 2026 19:10:08 +0000 (+0100) Subject: HID: asus: simplify and improve asus_kbd_set_report() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=43b3d1a95a587d32f3d441033d0aa108515a8c27;p=thirdparty%2Fkernel%2Flinux.git HID: asus: simplify and improve asus_kbd_set_report() Make the function shorter and easier to read using __free, and also fix a misaligned comment closing tag. The __free macro from cleanup.h is already used in the driver, but its include is missing: add it. Signed-off-by: Denis Benato Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 7513a0b3e155a..fa9a24f279f49 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -464,23 +465,16 @@ static int asus_raw_event(struct hid_device *hdev, static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size) { - unsigned char *dmabuf; - int ret; - - dmabuf = kmemdup(buf, buf_size, GFP_KERNEL); + u8 *dmabuf __free(kfree) = kmemdup(buf, buf_size, GFP_KERNEL); if (!dmabuf) return -ENOMEM; /* * The report ID should be set from the incoming buffer due to LED and key * interfaces having different pages - */ - ret = hid_hw_raw_request(hdev, buf[0], dmabuf, - buf_size, HID_FEATURE_REPORT, - HID_REQ_SET_REPORT); - kfree(dmabuf); - - return ret; + */ + return hid_hw_raw_request(hdev, buf[0], dmabuf, buf_size, HID_FEATURE_REPORT, + HID_REQ_SET_REPORT); } static int asus_kbd_init(struct hid_device *hdev, u8 report_id)