[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202006081404.59gC9C0e%lkp@intel.com>
Date: Mon, 8 Jun 2020 14:36:25 +0800
From: kernel test robot <lkp@...el.com>
To: Y Paritcher <y.linux@...itcher.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
Matthew Garrett <mjg59@...f.ucam.org>,
Pali Rohár <pali@...nel.org>
Subject: Re: [PATCH 3/3] platform/x86: dell-wmi: add keys to
bios_to_linux_keycode
Hi Paritcher,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/auto-latest]
[also build test WARNING on platform-drivers-x86/for-next linus/master linux/master v5.7 next-20200605]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Y-Paritcher/platform-x86-dell-wmi-new-keys/20200608-122408
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 22a1c800c96c83b7f4e3e02fad767502b70124fa
config: i386-randconfig-s002-20200608 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-247-gcadbd124-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
drivers/platform/x86/dell-wmi.c: In function 'handle_dmi_entry':
>> drivers/platform/x86/dell-wmi.c:506:38: warning: comparison is always true due to limited range of data type [-Wtype-limits]
506 | u16 keycode = (bios_entry->keycode <
| ^
vim +506 drivers/platform/x86/dell-wmi.c
a464afb9581f6a Andy Lutomirski 2016-02-15 464
bff589be59c509 Andy Lutomirski 2015-11-25 465 static void handle_dmi_entry(const struct dmi_header *dm, void *opaque)
5ea2559726b786 Rezwanul Kabir 2009-11-02 466 {
18b6f80f509503 Andy Lutomirski 2016-02-15 467 struct dell_dmi_results *results = opaque;
18b6f80f509503 Andy Lutomirski 2016-02-15 468 struct dell_bios_hotkey_table *table;
a464afb9581f6a Andy Lutomirski 2016-02-15 469 int hotkey_num, i, pos = 0;
890a7c8e8dc2d0 Dmitry Torokhov 2010-08-04 470 struct key_entry *keymap;
18b6f80f509503 Andy Lutomirski 2016-02-15 471
18b6f80f509503 Andy Lutomirski 2016-02-15 472 if (results->err || results->keymap)
18b6f80f509503 Andy Lutomirski 2016-02-15 473 return; /* We already found the hotkey table. */
18b6f80f509503 Andy Lutomirski 2016-02-15 474
074df51ca84d32 Andy Lutomirski 2016-02-17 475 /* The Dell hotkey table is type 0xB2. Scan until we find it. */
b13de7019c1b67 Andy Lutomirski 2016-02-15 476 if (dm->type != 0xb2)
18b6f80f509503 Andy Lutomirski 2016-02-15 477 return;
18b6f80f509503 Andy Lutomirski 2016-02-15 478
18b6f80f509503 Andy Lutomirski 2016-02-15 479 table = container_of(dm, struct dell_bios_hotkey_table, header);
18b6f80f509503 Andy Lutomirski 2016-02-15 480
b13de7019c1b67 Andy Lutomirski 2016-02-15 481 hotkey_num = (table->header.length -
b13de7019c1b67 Andy Lutomirski 2016-02-15 482 sizeof(struct dell_bios_hotkey_table)) /
18b6f80f509503 Andy Lutomirski 2016-02-15 483 sizeof(struct dell_bios_keymap_entry);
b13de7019c1b67 Andy Lutomirski 2016-02-15 484 if (hotkey_num < 1) {
b13de7019c1b67 Andy Lutomirski 2016-02-15 485 /*
b13de7019c1b67 Andy Lutomirski 2016-02-15 486 * Historically, dell-wmi would ignore a DMI entry of
b13de7019c1b67 Andy Lutomirski 2016-02-15 487 * fewer than 7 bytes. Sizes between 4 and 8 bytes are
b13de7019c1b67 Andy Lutomirski 2016-02-15 488 * nonsensical (both the header and all entries are 4
b13de7019c1b67 Andy Lutomirski 2016-02-15 489 * bytes), so we approximate the old behavior by
b13de7019c1b67 Andy Lutomirski 2016-02-15 490 * ignoring tables with fewer than one entry.
b13de7019c1b67 Andy Lutomirski 2016-02-15 491 */
b13de7019c1b67 Andy Lutomirski 2016-02-15 492 return;
b13de7019c1b67 Andy Lutomirski 2016-02-15 493 }
5ea2559726b786 Rezwanul Kabir 2009-11-02 494
e075b3c898e405 Pali Rohár 2016-06-15 495 keymap = kcalloc(hotkey_num, sizeof(struct key_entry), GFP_KERNEL);
18b6f80f509503 Andy Lutomirski 2016-02-15 496 if (!keymap) {
18b6f80f509503 Andy Lutomirski 2016-02-15 497 results->err = -ENOMEM;
18b6f80f509503 Andy Lutomirski 2016-02-15 498 return;
18b6f80f509503 Andy Lutomirski 2016-02-15 499 }
5ea2559726b786 Rezwanul Kabir 2009-11-02 500
5ea2559726b786 Rezwanul Kabir 2009-11-02 501 for (i = 0; i < hotkey_num; i++) {
890a7c8e8dc2d0 Dmitry Torokhov 2010-08-04 502 const struct dell_bios_keymap_entry *bios_entry =
18b6f80f509503 Andy Lutomirski 2016-02-15 503 &table->keymap[i];
cbc61f114af5fb Andy Lutomirski 2015-11-30 504
cbc61f114af5fb Andy Lutomirski 2015-11-30 505 /* Uninitialized entries are 0 aka KEY_RESERVED. */
cbc61f114af5fb Andy Lutomirski 2015-11-30 @506 u16 keycode = (bios_entry->keycode <
cbc61f114af5fb Andy Lutomirski 2015-11-30 507 ARRAY_SIZE(bios_to_linux_keycode)) ?
890a7c8e8dc2d0 Dmitry Torokhov 2010-08-04 508 bios_to_linux_keycode[bios_entry->keycode] :
890a7c8e8dc2d0 Dmitry Torokhov 2010-08-04 509 KEY_RESERVED;
8cb8e63b569895 Gabriele Mazzotta 2014-12-04 510
cbc61f114af5fb Andy Lutomirski 2015-11-30 511 /*
cbc61f114af5fb Andy Lutomirski 2015-11-30 512 * Log if we find an entry in the DMI table that we don't
cbc61f114af5fb Andy Lutomirski 2015-11-30 513 * understand. If this happens, we should figure out what
cbc61f114af5fb Andy Lutomirski 2015-11-30 514 * the entry means and add it to bios_to_linux_keycode.
cbc61f114af5fb Andy Lutomirski 2015-11-30 515 */
cbc61f114af5fb Andy Lutomirski 2015-11-30 516 if (keycode == KEY_RESERVED) {
cbc61f114af5fb Andy Lutomirski 2015-11-30 517 pr_info("firmware scancode 0x%x maps to unrecognized keycode 0x%x\n",
cbc61f114af5fb Andy Lutomirski 2015-11-30 518 bios_entry->scancode, bios_entry->keycode);
cbc61f114af5fb Andy Lutomirski 2015-11-30 519 continue;
cbc61f114af5fb Andy Lutomirski 2015-11-30 520 }
cbc61f114af5fb Andy Lutomirski 2015-11-30 521
8cb8e63b569895 Gabriele Mazzotta 2014-12-04 522 if (keycode == KEY_KBDILLUMTOGGLE)
a464afb9581f6a Andy Lutomirski 2016-02-15 523 keymap[pos].type = KE_IGNORE;
8cb8e63b569895 Gabriele Mazzotta 2014-12-04 524 else
a464afb9581f6a Andy Lutomirski 2016-02-15 525 keymap[pos].type = KE_KEY;
a464afb9581f6a Andy Lutomirski 2016-02-15 526 keymap[pos].code = bios_entry->scancode;
a464afb9581f6a Andy Lutomirski 2016-02-15 527 keymap[pos].keycode = keycode;
a464afb9581f6a Andy Lutomirski 2016-02-15 528
a464afb9581f6a Andy Lutomirski 2016-02-15 529 pos++;
a464afb9581f6a Andy Lutomirski 2016-02-15 530 }
a464afb9581f6a Andy Lutomirski 2016-02-15 531
18b6f80f509503 Andy Lutomirski 2016-02-15 532 results->keymap = keymap;
e075b3c898e405 Pali Rohár 2016-06-15 533 results->keymap_size = pos;
5ea2559726b786 Rezwanul Kabir 2009-11-02 534 }
5ea2559726b786 Rezwanul Kabir 2009-11-02 535
:::::: The code at line 506 was first introduced by commit
:::::: cbc61f114af5fb078d84dc8864152f4db1712bc5 dell-wmi: Improve unknown hotkey handling
:::::: TO: Andy Lutomirski <luto@...nel.org>
:::::: CC: Darren Hart <dvhart@...ux.intel.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (39047 bytes)
Powered by blists - more mailing lists