All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: John Hughes <john@calvaedi.com>
Cc: platform-driver-x86@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: re: drivers/platform/x86/sony-laptop.c: fix scancodes
Date: Wed, 30 Nov 2011 15:55:45 +0300	[thread overview]
Message-ID: <20111130125545.GA5815@elgon.mountain> (raw)

Hi John,

Commit 04840b50f395 "drivers/platform/x86/sony-laptop.c: fix scancodes"
introduces a gcc warning:

drivers/platform/x86/sony-laptop.c:395:14: warning:
	‘scancode’ may be used uninitialized in this function [-Wuninitialized]

   345  static void sony_laptop_report_input_event(u8 event)
   346  {
   347          struct input_dev *jog_dev = sony_laptop_input.jog_dev;
   348          struct input_dev *key_dev = sony_laptop_input.key_dev;
   349          struct sony_laptop_keypress kp = { NULL };
   350          int scancode;
   351  

-- [snip] --

   373          /* key_dev events */
   374          case SONYPI_EVENT_JOGDIAL_PRESSED:
   375                  kp.key = BTN_MIDDLE;
   376                  kp.dev = jog_dev;
   377                  break;

scancode doesn't get initialized on this path, but kp.dev is set.

   378  
   379          default:
   380                  if (event >= ARRAY_SIZE(sony_laptop_input_index)) {
   381                          dprintk("sony_laptop_report_input_event, event not known: %d\n", event);
   382                          break;
   383                  }
   384                  scancode = sony_laptop_input_index[event];
   385                  if (scancode != -1) {
   386                          kp.key = sony_laptop_input_keycode_map[scancode];
   387                          if (kp.key != KEY_UNKNOWN)
   388                                  kp.dev = key_dev;
   389                  }
   390                  break;
   391          }
   392  
   393          if (kp.dev) {
   394                  /* we emit the scancode so we can always remap the key */
   395                  input_event(kp.dev, EV_MSC, MSC_SCAN, scancode);

We use scancode here.

regards,
dan carpenter

             reply	other threads:[~2011-11-30 12:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 12:55 Dan Carpenter [this message]
2011-11-30 13:22 ` drivers/platform/x86/sony-laptop.c: fix scancodes John Hughes
2011-11-30 21:50 ` John Hughes
2011-12-03 11:47 ` [PATCH] Fix scancodes emitted by sony-laptop driver (Version 2 with warnings fixed) John Hughes

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=20111130125545.GA5815@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=john@calvaedi.com \
    --cc=platform-driver-x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.