aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hidraw.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2011-05-15 12:07:42 -0400
committerJiri Kosina <jkosina@suse.cz>2011-05-18 07:23:31 -0400
commitdd2ed487fdd78b50549b2ca8418875c0d9f4a30e (patch)
tree9bbd190e222eb02f7c39845b9e9e96c524fe39cd /drivers/hid/hidraw.c
parent8c4e708d01424f88afde64a96ffd05146c9978b8 (diff)
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>
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r--drivers/hid/hidraw.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 93c72e593701..c79578b5a788 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -395,12 +395,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
395 } 395 }
396 396
397 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { 397 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) {
398 int len; 398 int len = strlen(hid->name) + 1;
399 if (!hid->name) {
400 ret = 0;
401 break;
402 }
403 len = strlen(hid->name) + 1;
404 if (len > _IOC_SIZE(cmd)) 399 if (len > _IOC_SIZE(cmd))
405 len = _IOC_SIZE(cmd); 400 len = _IOC_SIZE(cmd);
406 ret = copy_to_user(user_arg, hid->name, len) ? 401 ret = copy_to_user(user_arg, hid->name, len) ?
@@ -409,12 +404,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
409 } 404 }
410 405
411 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { 406 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) {
412 int len; 407 int len = strlen(hid->phys) + 1;
413 if (!hid->phys) {
414 ret = 0;
415 break;
416 }
417 len = strlen(hid->phys) + 1;
418 if (len > _IOC_SIZE(cmd)) 408 if (len > _IOC_SIZE(cmd))
419 len = _IOC_SIZE(cmd); 409 len = _IOC_SIZE(cmd);
420 ret = copy_to_user(user_arg, hid->phys, len) ? 410 ret = copy_to_user(user_arg, hid->phys, len) ?