Skip to content

Commit 02cc097

Browse files
LekensteynJiri Kosina
authored andcommitted
HID: logitech-hidpp: do not return the name length
We do not make any use of the actual name length get through hidpp_get_device_name(). Original patch by Benjamin Tissoires, this patch also replaces a (now) unnecessary goto by return NULL. Signed-off-by: Peter Wu <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 552f12e commit 02cc097

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

drivers/hid/hid-logitech-hidpp.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static int hidpp_devicenametype_get_device_name(struct hidpp_device *hidpp,
461461
return count;
462462
}
463463

464-
static char *hidpp_get_device_name(struct hidpp_device *hidpp, u8 *name_length)
464+
static char *hidpp_get_device_name(struct hidpp_device *hidpp)
465465
{
466466
u8 feature_type;
467467
u8 feature_index;
@@ -473,28 +473,23 @@ static char *hidpp_get_device_name(struct hidpp_device *hidpp, u8 *name_length)
473473
ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_GET_DEVICE_NAME_TYPE,
474474
&feature_index, &feature_type);
475475
if (ret)
476-
goto out_err;
476+
return NULL;
477477

478478
ret = hidpp_devicenametype_get_count(hidpp, feature_index,
479479
&__name_length);
480480
if (ret)
481-
goto out_err;
481+
return NULL;
482482

483483
name = kzalloc(__name_length + 1, GFP_KERNEL);
484484
if (!name)
485-
goto out_err;
485+
return NULL;
486486

487-
*name_length = __name_length + 1;
488487
while (index < __name_length)
489488
index += hidpp_devicenametype_get_device_name(hidpp,
490489
feature_index, index, name + index,
491490
__name_length - index);
492491

493492
return name;
494-
495-
out_err:
496-
*name_length = 0;
497-
return NULL;
498493
}
499494

500495
/* -------------------------------------------------------------------------- */
@@ -989,7 +984,6 @@ static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying)
989984
{
990985
struct hidpp_device *hidpp = hid_get_drvdata(hdev);
991986
char *name;
992-
u8 name_length;
993987

994988
if (use_unifying)
995989
/*
@@ -999,7 +993,7 @@ static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying)
999993
*/
1000994
name = hidpp_get_unifying_name(hidpp);
1001995
else
1002-
name = hidpp_get_device_name(hidpp, &name_length);
996+
name = hidpp_get_device_name(hidpp);
1003997

1004998
if (!name)
1005999
hid_err(hdev, "unable to retrieve the name of the device");
@@ -1053,7 +1047,6 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
10531047
bool connected = atomic_read(&hidpp->connected);
10541048
struct input_dev *input;
10551049
char *name, *devm_name;
1056-
u8 name_length;
10571050

10581051
if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)
10591052
wtp_connect(hdev, connected);
@@ -1080,7 +1073,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
10801073
return;
10811074
}
10821075

1083-
name = hidpp_get_device_name(hidpp, &name_length);
1076+
name = hidpp_get_device_name(hidpp);
10841077
if (!name) {
10851078
hid_err(hdev, "unable to retrieve the name of the device");
10861079
} else {

0 commit comments

Comments
 (0)