diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-12-11 07:51:17 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-12-11 17:10:00 -0500 |
commit | 02cc097e62d51bf6e5cb4209ca90d9bf68e358b5 (patch) | |
tree | 6d375fc4b1fa942a10b22f6a3a039fd9f7cf64d2 /drivers | |
parent | 552f12eb68440a0328dc9929066f6d0321a75874 (diff) |
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 <peter@lekensteyn.nl>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/hid-logitech-hidpp.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 1a6395d0c2bd..5066df8afee5 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c | |||
@@ -461,7 +461,7 @@ static int hidpp_devicenametype_get_device_name(struct hidpp_device *hidpp, | |||
461 | return count; | 461 | return count; |
462 | } | 462 | } |
463 | 463 | ||
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) |
465 | { | 465 | { |
466 | u8 feature_type; | 466 | u8 feature_type; |
467 | u8 feature_index; | 467 | u8 feature_index; |
@@ -473,28 +473,23 @@ static char *hidpp_get_device_name(struct hidpp_device *hidpp, u8 *name_length) | |||
473 | ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_GET_DEVICE_NAME_TYPE, | 473 | ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_GET_DEVICE_NAME_TYPE, |
474 | &feature_index, &feature_type); | 474 | &feature_index, &feature_type); |
475 | if (ret) | 475 | if (ret) |
476 | goto out_err; | 476 | return NULL; |
477 | 477 | ||
478 | ret = hidpp_devicenametype_get_count(hidpp, feature_index, | 478 | ret = hidpp_devicenametype_get_count(hidpp, feature_index, |
479 | &__name_length); | 479 | &__name_length); |
480 | if (ret) | 480 | if (ret) |
481 | goto out_err; | 481 | return NULL; |
482 | 482 | ||
483 | name = kzalloc(__name_length + 1, GFP_KERNEL); | 483 | name = kzalloc(__name_length + 1, GFP_KERNEL); |
484 | if (!name) | 484 | if (!name) |
485 | goto out_err; | 485 | return NULL; |
486 | 486 | ||
487 | *name_length = __name_length + 1; | ||
488 | while (index < __name_length) | 487 | while (index < __name_length) |
489 | index += hidpp_devicenametype_get_device_name(hidpp, | 488 | index += hidpp_devicenametype_get_device_name(hidpp, |
490 | feature_index, index, name + index, | 489 | feature_index, index, name + index, |
491 | __name_length - index); | 490 | __name_length - index); |
492 | 491 | ||
493 | return name; | 492 | return name; |
494 | |||
495 | out_err: | ||
496 | *name_length = 0; | ||
497 | return NULL; | ||
498 | } | 493 | } |
499 | 494 | ||
500 | /* -------------------------------------------------------------------------- */ | 495 | /* -------------------------------------------------------------------------- */ |
@@ -989,7 +984,6 @@ static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying) | |||
989 | { | 984 | { |
990 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 985 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
991 | char *name; | 986 | char *name; |
992 | u8 name_length; | ||
993 | 987 | ||
994 | if (use_unifying) | 988 | if (use_unifying) |
995 | /* | 989 | /* |
@@ -999,7 +993,7 @@ static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying) | |||
999 | */ | 993 | */ |
1000 | name = hidpp_get_unifying_name(hidpp); | 994 | name = hidpp_get_unifying_name(hidpp); |
1001 | else | 995 | else |
1002 | name = hidpp_get_device_name(hidpp, &name_length); | 996 | name = hidpp_get_device_name(hidpp); |
1003 | 997 | ||
1004 | if (!name) | 998 | if (!name) |
1005 | hid_err(hdev, "unable to retrieve the name of the device"); | 999 | hid_err(hdev, "unable to retrieve the name of the device"); |
@@ -1053,7 +1047,6 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) | |||
1053 | bool connected = atomic_read(&hidpp->connected); | 1047 | bool connected = atomic_read(&hidpp->connected); |
1054 | struct input_dev *input; | 1048 | struct input_dev *input; |
1055 | char *name, *devm_name; | 1049 | char *name, *devm_name; |
1056 | u8 name_length; | ||
1057 | 1050 | ||
1058 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | 1051 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) |
1059 | wtp_connect(hdev, connected); | 1052 | wtp_connect(hdev, connected); |
@@ -1080,7 +1073,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) | |||
1080 | return; | 1073 | return; |
1081 | } | 1074 | } |
1082 | 1075 | ||
1083 | name = hidpp_get_device_name(hidpp, &name_length); | 1076 | name = hidpp_get_device_name(hidpp); |
1084 | if (!name) { | 1077 | if (!name) { |
1085 | hid_err(hdev, "unable to retrieve the name of the device"); | 1078 | hid_err(hdev, "unable to retrieve the name of the device"); |
1086 | } else { | 1079 | } else { |