Commit baacf9c5d2e631e7c940527ad670c8d4b019da81

Authored by Bruno Prémont
Committed by Jiri Kosina
1 parent b07072e6a2

HID: picoLCD: satify some checkpatch warnings

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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

drivers/hid/hid-picolcd_debugfs.c
... ... @@ -135,7 +135,7 @@
135 135 memset(raw_data, 0, sizeof(raw_data));
136 136 raw_data[0] = *off & 0xff;
137 137 raw_data[1] = (*off >> 8) & 0xff;
138   - raw_data[2] = min((size_t)20, s);
  138 + raw_data[2] = min_t(size_t, 20, s);
139 139 if (*off + raw_data[2] > 0xff)
140 140 raw_data[2] = 0x100 - *off;
141 141  
... ... @@ -370,7 +370,7 @@
370 370 /*
371 371 * Helper code for HID report level dumping/debugging
372 372 */
373   -static const char *error_codes[] = {
  373 +static const char * const error_codes[] = {
374 374 "success", "parameter missing", "data_missing", "block readonly",
375 375 "block not erasable", "block too big", "section overflow",
376 376 "invalid command length", "invalid data length",