HID: 'name' and 'phys' in 'struct hid_device' can never be NULL
authorDaniel Mack <zonque@gmail.com>
Sun, 15 May 2011 16:07:42 +0000 (18:07 +0200)
committerJiri Kosina <jkosina@suse.cz>
Wed, 18 May 2011 11:23:31 +0000 (13:23 +0200)
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>
drivers/hid/hidraw.c
drivers/hid/usbhid/hiddev.c

index 93c72e593701129bc24d706b7245e405dad99525..c79578b5a788f48ba74ec9aa2df5c82b8385b882 100644 (file)
@@ -395,12 +395,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
                                }
 
                                if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) {
-                                       int len;
-                                       if (!hid->name) {
-                                               ret = 0;
-                                               break;
-                                       }
-                                       len = strlen(hid->name) + 1;
+                                       int len = strlen(hid->name) + 1;
                                        if (len > _IOC_SIZE(cmd))
                                                len = _IOC_SIZE(cmd);
                                        ret = copy_to_user(user_arg, hid->name, len) ?
@@ -409,12 +404,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
                                }
 
                                if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) {
-                                       int len;
-                                       if (!hid->phys) {
-                                               ret = 0;
-                                               break;
-                                       }
-                                       len = strlen(hid->phys) + 1;
+                                       int len = strlen(hid->phys) + 1;
                                        if (len > _IOC_SIZE(cmd))
                                                len = _IOC_SIZE(cmd);
                                        ret = copy_to_user(user_arg, hid->phys, len) ?
index 527003188bfe85d716d2af3dd6e980ea1789a92c..2baa71e6cc2967d64173388694e7765d8d43742d 100644 (file)
@@ -801,14 +801,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                        break;
 
                if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) {
-                       int len;
-
-                       if (!hid->name) {
-                               r = 0;
-                               break;
-                       }
-
-                       len = strlen(hid->name) + 1;
+                       int len = strlen(hid->name) + 1;
                        if (len > _IOC_SIZE(cmd))
                                 len = _IOC_SIZE(cmd);
                        r = copy_to_user(user_arg, hid->name, len) ?
@@ -817,14 +810,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                }
 
                if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) {
-                       int len;
-
-                       if (!hid->phys) {
-                               r = 0;
-                               break;
-                       }
-
-                       len = strlen(hid->phys) + 1;
+                       int len = strlen(hid->phys) + 1;
                        if (len > _IOC_SIZE(cmd))
                                len = _IOC_SIZE(cmd);
                        r = copy_to_user(user_arg, hid->phys, len) ?