linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Komal Shah <komal_shah802003@yahoo.com>
Cc: linux-input@vger.kernel.org
Subject: re: [PATCH] OMAP: Add keypad driver
Date: Thu, 7 Jan 2016 12:37:51 +0300	[thread overview]
Message-ID: <20160107093751.GD27186@mwanda> (raw)

Hello file (standard input) matches,

The patch ad4e09b16ad3: "[PATCH] OMAP: Add keypad driver", leads to the
following static checker warning:

	drivers/input/keyboard/omap-keypad.c:158 omap_kp_tasklet()
	warn: 'keycodes[]' is never negative.

drivers/input/keyboard/omap-keypad.c
   129  static void omap_kp_tasklet(unsigned long data)
   130  {
   131          struct omap_kp *omap_kp_data = (struct omap_kp *) data;
   132          unsigned short *keycodes = omap_kp_data->input->keycode;
                ^^^^^^^^^^^^^^^^^^^^^^^^
   133          unsigned int row_shift = get_count_order(omap_kp_data->cols);
   134          unsigned char new_state[8], changed, key_down = 0;
   135          int col, row;
   136          int spurious = 0;
   137  
   138          /* check for any changes */
   139          omap_kp_scan_keypad(omap_kp_data, new_state);
   140  
   141          /* check for changes and print those */
   142          for (col = 0; col < omap_kp_data->cols; col++) {
   143                  changed = new_state[col] ^ keypad_state[col];
   144                  key_down |= new_state[col];
   145                  if (changed == 0)
   146                          continue;
   147  
   148                  for (row = 0; row < omap_kp_data->rows; row++) {
   149                          int key;
                                ^^^^^^^
   150                          if (!(changed & (1 << row)))
   151                                  continue;
   152  #ifdef NEW_BOARD_LEARNING_MODE
   153                          printk(KERN_INFO "omap-keypad: key %d-%d %s\n", col,
   154                                 row, (new_state[col] & (1 << row)) ?
   155                                 "pressed" : "released");
   156  #else
   157                          key = keycodes[MATRIX_SCAN_CODE(row, col, row_shift)];
   158                          if (key < 0) {
                                    ^^^^^^^
Never true.  Not sure what was intended.

   159                                  printk(KERN_WARNING
   160                                        "omap-keypad: Spurious key event %d-%d\n",
   161                                         col, row);
   162                                  /* We scan again after a couple of seconds */
   163                                  spurious = 1;
   164                                  continue;
   165                          }
   166  
   167                          if (!(kp_cur_group == (key & GROUP_MASK) ||
   168                                kp_cur_group == -1))
   169                                  continue;
   170  

regards,
dan carpenter

             reply	other threads:[~2016-01-07  9:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07  9:37 Dan Carpenter [this message]
2016-01-07 18:54 ` [PATCH] OMAP: Add keypad driver Dmitry Torokhov
2016-01-07 20:13   ` Tony Lindgren
2016-01-07 23:22     ` Dmitry Torokhov
2016-01-08  0:08       ` Koskinen, Aaro (Nokia - FI/Espoo)
2016-01-08  0:13         ` Tony Lindgren
2016-01-08  0:10       ` Tony Lindgren
2016-01-08  1:41       ` Janusz Krzysztofik
2016-01-08  6:38         ` Dmitry Torokhov

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=20160107093751.GD27186@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=komal_shah802003@yahoo.com \
    --cc=linux-input@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).