From patchwork Sun May 15 16:07:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 786232 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4FGEGtm016251 for ; Sun, 15 May 2011 16:14:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760091Ab1EOQOO (ORCPT ); Sun, 15 May 2011 12:14:14 -0400 Received: from mail.bugwerft.de ([212.112.241.193]:40621 "EHLO mail.bugwerft.de" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1760066Ab1EOQOO (ORCPT ); Sun, 15 May 2011 12:14:14 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 15 May 2011 16:14:16 +0000 (UTC) X-Greylist: delayed 380 seconds by postgrey-1.27 at vger.kernel.org; Sun, 15 May 2011 12:14:14 EDT Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.bugwerft.de (Postfix) with ESMTP id BFBA28F8418; Sun, 15 May 2011 18:07:51 +0200 (CEST) Received: from mail.bugwerft.de ([127.0.0.1]) by localhost (rambrand.caiaq.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nOl2BkxnLYoO; Sun, 15 May 2011 18:07:51 +0200 (CEST) Received: from jup (i59F73697.versanet.de [89.247.54.151]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bugwerft.de (Postfix) with ESMTPSA id 5B1818F8417; Sun, 15 May 2011 18:07:51 +0200 (CEST) From: Daniel Mack To: linux-input@vger.kernel.org Cc: Daniel Mack , Dmitry Torokhov , Jiri Kosina Subject: [PATCH] input: members 'name' and 'phys' of 'struct hid_device' can never be NULL Date: Sun, 15 May 2011 18:07:42 +0200 Message-Id: <1305475662-4478-1-git-send-email-zonque@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org As they are static members of fix size, there is no need to them. Signed-off-by: Daniel Mack Cc: Dmitry Torokhov Cc: Jiri Kosina --- drivers/hid/hidraw.c | 14 ++------------ drivers/hid/usbhid/hiddev.c | 18 ++---------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 54409cb..3dd1877 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, } 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) ? diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index af0a7c1..5ca9c35 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -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) ?