Commit dd2ed487fdd78b50549b2ca8418875c0d9f4a30e
Committed by
Jiri Kosina
1 parent
8c4e708d01
Exists in
master
and in
7 other branches
HID: 'name' and 'phys' in 'struct hid_device' can never be NULL
As they are static members of fix size, there is no need to NULL-check them. Signed-off-by: Daniel Mack <zonque@gmail.com> Cc: Dmitry Torokhov <dtor@mail.ru> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Showing 2 changed files with 4 additions and 28 deletions Side-by-side Diff
drivers/hid/hidraw.c
... | ... | @@ -395,12 +395,7 @@ |
395 | 395 | } |
396 | 396 | |
397 | 397 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { |
398 | - int len; | |
399 | - if (!hid->name) { | |
400 | - ret = 0; | |
401 | - break; | |
402 | - } | |
403 | - len = strlen(hid->name) + 1; | |
398 | + int len = strlen(hid->name) + 1; | |
404 | 399 | if (len > _IOC_SIZE(cmd)) |
405 | 400 | len = _IOC_SIZE(cmd); |
406 | 401 | ret = copy_to_user(user_arg, hid->name, len) ? |
... | ... | @@ -409,12 +404,7 @@ |
409 | 404 | } |
410 | 405 | |
411 | 406 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { |
412 | - int len; | |
413 | - if (!hid->phys) { | |
414 | - ret = 0; | |
415 | - break; | |
416 | - } | |
417 | - len = strlen(hid->phys) + 1; | |
407 | + int len = strlen(hid->phys) + 1; | |
418 | 408 | if (len > _IOC_SIZE(cmd)) |
419 | 409 | len = _IOC_SIZE(cmd); |
420 | 410 | ret = copy_to_user(user_arg, hid->phys, len) ? |
drivers/hid/usbhid/hiddev.c
... | ... | @@ -801,14 +801,7 @@ |
801 | 801 | break; |
802 | 802 | |
803 | 803 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) { |
804 | - int len; | |
805 | - | |
806 | - if (!hid->name) { | |
807 | - r = 0; | |
808 | - break; | |
809 | - } | |
810 | - | |
811 | - len = strlen(hid->name) + 1; | |
804 | + int len = strlen(hid->name) + 1; | |
812 | 805 | if (len > _IOC_SIZE(cmd)) |
813 | 806 | len = _IOC_SIZE(cmd); |
814 | 807 | r = copy_to_user(user_arg, hid->name, len) ? |
... | ... | @@ -817,14 +810,7 @@ |
817 | 810 | } |
818 | 811 | |
819 | 812 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) { |
820 | - int len; | |
821 | - | |
822 | - if (!hid->phys) { | |
823 | - r = 0; | |
824 | - break; | |
825 | - } | |
826 | - | |
827 | - len = strlen(hid->phys) + 1; | |
813 | + int len = strlen(hid->phys) + 1; | |
828 | 814 | if (len > _IOC_SIZE(cmd)) |
829 | 815 | len = _IOC_SIZE(cmd); |
830 | 816 | r = copy_to_user(user_arg, hid->phys, len) ? |