From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiri Kosina <jkosina@suse.cz>
Cc: Jaya Kumar <jayalk@intworks.biz>, linux-fbdev@vger.kernel.org
Subject: [PATCH 4/7] HID: picoLCD: satify some checkpatch warnings
Date: Mon, 30 Jul 2012 19:38:54 +0000 [thread overview]
Message-ID: <20120730213854.4bb52224@neptune.home> (raw)
In-Reply-To: 20120730213656.0a9f6d30@neptune.home
WARNING: static const char * array should probably be static const char * const
+static const char *error_codes[] = {
WARNING: min() should probably be min_t(size_t, 20, s)
+ raw_data[2] = min((size_t)20, s);
Note: the second min_t suggestion cannot be followed because GCC is not
smart enough to track constants through it and make
copy_from_user_overflow() check happy.
WARNING: min() should probably be min_t(u8, 20, raw_data[2])
+ if (copy_from_user(raw_data+3, u, min((u8)20, raw_data[2])))
return -EFAULT;
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
---
drivers/hid/hid-picolcd_debugfs.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-picolcd_debugfs.c b/drivers/hid/hid-picolcd_debugfs.c
index ff74645..f2491fa 100644
--- a/drivers/hid/hid-picolcd_debugfs.c
+++ b/drivers/hid/hid-picolcd_debugfs.c
@@ -135,7 +135,7 @@ static ssize_t picolcd_debug_eeprom_write(struct file *f, const char __user *u,
memset(raw_data, 0, sizeof(raw_data));
raw_data[0] = *off & 0xff;
raw_data[1] = (*off >> 8) & 0xff;
- raw_data[2] = min((size_t)20, s);
+ raw_data[2] = min_t(size_t, 20, s);
if (*off + raw_data[2] > 0xff)
raw_data[2] = 0x100 - *off;
@@ -370,7 +370,7 @@ static const struct file_operations picolcd_debug_flash_fops = {
/*
* Helper code for HID report level dumping/debugging
*/
-static const char *error_codes[] = {
+static const char * const error_codes[] = {
"success", "parameter missing", "data_missing", "block readonly",
"block not erasable", "block too big", "section overflow",
"invalid command length", "invalid data length",
--
1.7.8.6
next prev parent reply other threads:[~2012-07-30 19:38 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 19:36 [PATCH 0/7] HID: picoLCD updates Bruno Prémont
2012-07-30 19:38 ` [PATCH 2/7] HID: picoLCD: Replace own refcounting with fbdev's Bruno Prémont
2012-07-30 19:38 ` [PATCH 3/7] HID: picoLCD: prevent NULL pointer dereference on unplug Bruno Prémont
2012-07-30 19:38 ` Bruno Prémont [this message]
2012-07-30 19:38 ` [PATCH 5/7] HID: picoLCD: Improve unplug handling Bruno Prémont
2012-07-30 19:38 ` [PATCH 6/7] HID: picoLCD: disable version check during probe Bruno Prémont
2012-08-15 8:15 ` Jiri Kosina
2012-08-19 16:56 ` [PATCH 6/7 v2] HID: picoLCD: drop " Bruno Prémont
2012-09-17 18:21 ` Bruno Prémont
2012-09-19 11:45 ` Jiri Kosina
2012-07-30 19:39 ` [PATCH 7/7] HID: picoLCD: add myself to MAINTAINERS Bruno Prémont
[not found] ` <20120730213828.6c78f8f3@neptune.home>
2012-07-30 19:59 ` [PATCH 1/7] HID: picoLCD: split driver code Bruno Prémont
2012-07-31 7:26 ` [PATCH 0/7] HID: picoLCD updates David Herrmann
2012-07-31 7:59 ` Bruno Prémont
2012-08-09 18:09 ` Bruno Prémont
2012-08-13 23:27 ` Tejun Heo
2012-08-14 6:30 ` Bruno Prémont
2012-08-14 17:31 ` Tejun Heo
2012-08-15 8:27 ` Jiri Kosina
2012-08-15 9:42 ` Bruno Prémont
2012-08-15 12:11 ` Jiri Kosina
2012-08-15 15:16 ` Bruno Prémont
2012-08-15 21:32 ` Jiri Kosina
2012-08-16 16:30 ` Bruno Prémont
2012-08-16 16:47 ` Jiri Kosina
2012-08-18 12:40 ` Bruno Prémont
2012-08-18 13:19 ` Alan Stern
2012-08-18 13:48 ` Bruno Prémont
2012-08-18 18:49 ` Bruno Prémont
2012-08-19 0:11 ` Alan Stern
2012-08-19 16:23 ` Bruno Prémont
2012-08-19 19:56 ` Alan Stern
2012-08-19 17:28 ` [PATCH 0/6] HID: picoLCD additional fixes + CIR support Bruno Prémont
2012-08-19 17:32 ` [PATCH 2/6] HID: picoLCD: rework hid-fbdev interaction Bruno Prémont
2012-09-05 9:50 ` [PATCH 0/6] HID: picoLCD additional fixes + CIR support Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120730213854.4bb52224@neptune.home \
--to=bonbons@linux-vserver.org \
--cc=jayalk@intworks.biz \
--cc=jkosina@suse.cz \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).