Skip to content

Commit 06ae5af

Browse files
NeroReflexJiri Kosina
authored andcommitted
HID: hid-asus: add const to read-only outgoing usb buffer
In the function asus_kbd_set_report the parameter buf is read-only as it gets copied in a memory portion suitable for USB transfer, but the parameter is not marked as const: add the missing const and mark const immutable buffers passed to that function. Signed-off-by: Denis Benato <[email protected]> Signed-off-by: Luke D. Jones <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 5b4ffb1 commit 06ae5af

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/hid/hid-asus.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ static int asus_raw_event(struct hid_device *hdev,
381381
return 0;
382382
}
383383

384-
static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size)
384+
static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size)
385385
{
386386
unsigned char *dmabuf;
387387
int ret;
@@ -404,7 +404,7 @@ static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size
404404

405405
static int asus_kbd_init(struct hid_device *hdev)
406406
{
407-
u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
407+
const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
408408
0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
409409
int ret;
410410

@@ -418,7 +418,7 @@ static int asus_kbd_init(struct hid_device *hdev)
418418
static int asus_kbd_get_functions(struct hid_device *hdev,
419419
unsigned char *kbd_func)
420420
{
421-
u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 };
421+
const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 };
422422
u8 *readbuf;
423423
int ret;
424424

@@ -449,7 +449,7 @@ static int asus_kbd_get_functions(struct hid_device *hdev,
449449

450450
static int rog_nkey_led_init(struct hid_device *hdev)
451451
{
452-
u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 };
452+
const u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 };
453453
u8 buf_init2[] = { FEATURE_KBD_LED_REPORT_ID1, 0x41, 0x53, 0x55, 0x53, 0x20,
454454
0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
455455
u8 buf_init3[] = { FEATURE_KBD_LED_REPORT_ID1,

0 commit comments

Comments
 (0)