Linux Input/HID development
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Joshua Leivenzon <hacker1024@users.sourceforge.net>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-input@vger.kernel.org, Jiri Kosina <jikos@kernel.org>
Subject: [hid:for-7.2/asus 1/7] drivers/hid/hid-asus.c:1399:14: warning: variable 'rsize_orig' is used uninitialized whenever 'if' condition is false
Date: Thu, 11 Jun 2026 06:05:53 +0200	[thread overview]
Message-ID: <202606110526.QfgiXQTQ-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-7.2/asus
head:   9bde6277292c8233fb24fc6e51323027b49d1cde
commit: 92f9f783f013a27a175089950b7b22c3d5a48249 [1/7] HID: asus: Fix up Zenbook Duo report descriptors
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260611/202606110526.QfgiXQTQ-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project f43d6834093b19baf79beda8c0337ab020ac5f17)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260611/202606110526.QfgiXQTQ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606110526.QfgiXQTQ-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/hid/hid-asus.c:1399:14: warning: variable 'rsize_orig' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    1399 |                 } else if (drvdata->quirks & QUIRK_ZENBOOK_DUO_KEYBOARD) {
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-asus.c:1410:17: note: uninitialized use occurs here
    1410 |                 if (*rsize == rsize_orig &&
         |                               ^~~~~~~~~~
   drivers/hid/hid-asus.c:1399:10: note: remove the 'if' if its condition is always true
    1399 |                 } else if (drvdata->quirks & QUIRK_ZENBOOK_DUO_KEYBOARD) {
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-asus.c:1390:17: note: initialize the variable 'rsize_orig' to silence this warning
    1390 |                 int rsize_orig;
         |                               ^
         |                                = 0
   1 warning generated.


vim +1399 drivers/hid/hid-asus.c

  1370	
  1371	static const __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  1372			unsigned int *rsize)
  1373	{
  1374		struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
  1375	
  1376		if (drvdata->quirks & QUIRK_FIX_NOTEBOOK_REPORT &&
  1377				*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x65) {
  1378			hid_info(hdev, "Fixing up Asus notebook report descriptor\n");
  1379			rdesc[55] = 0xdd;
  1380		}
  1381		/* For the T100TA/T200TA keyboard dock */
  1382		if (drvdata->quirks & QUIRK_T100_KEYBOARD &&
  1383			 (*rsize == 76 || *rsize == 101) &&
  1384			 rdesc[73] == 0x81 && rdesc[74] == 0x01) {
  1385			hid_info(hdev, "Fixing up Asus T100 keyb report descriptor\n");
  1386			rdesc[74] &= ~HID_MAIN_ITEM_CONSTANT;
  1387		}
  1388		/* For the T100CHI/T90CHI keyboard dock and Zenbook Duo 2024+ keyboards */
  1389		if (drvdata->quirks & (QUIRK_T100CHI | QUIRK_T90CHI | QUIRK_ZENBOOK_DUO_KEYBOARD)) {
  1390			int rsize_orig;
  1391			int offs;
  1392	
  1393			if (drvdata->quirks & QUIRK_T100CHI) {
  1394				rsize_orig = 403;
  1395				offs = 388;
  1396			} else if (drvdata->quirks & QUIRK_T90CHI) {
  1397				rsize_orig = 306;
  1398				offs = 291;
> 1399			} else if (drvdata->quirks & QUIRK_ZENBOOK_DUO_KEYBOARD) {
  1400				rsize_orig = 257;
  1401				offs = 176;
  1402			}
  1403	
  1404			/*
  1405			 * Change Usage (76h) to Usage Minimum (00h), Usage Maximum
  1406			 * (FFh) and clear the flags in the Input() byte.
  1407			 * Note the descriptor has a bogus 0 byte at the end so we
  1408			 * only need 1 extra byte.
  1409			 */
  1410			if (*rsize == rsize_orig &&
  1411				rdesc[offs] == 0x09 && rdesc[offs + 1] == 0x76) {
  1412				__u8 *new_rdesc;
  1413	
  1414				new_rdesc = devm_kzalloc(&hdev->dev, rsize_orig + 1,
  1415							 GFP_KERNEL);
  1416				if (!new_rdesc)
  1417					return rdesc;
  1418	
  1419				hid_info(hdev, "Fixing up %s keyb report descriptor\n",
  1420					drvdata->quirks & QUIRK_T100CHI ?
  1421					"T100CHI" : drvdata->quirks & QUIRK_T90CHI ?
  1422					"T90CHI" : "ZENBOOK DUO");
  1423	
  1424				memcpy(new_rdesc, rdesc, rsize_orig);
  1425				*rsize = rsize_orig + 1;
  1426				rdesc = new_rdesc;
  1427	
  1428				memmove(rdesc + offs + 4, rdesc + offs + 2, 12);
  1429				rdesc[offs] = 0x19;
  1430				rdesc[offs + 1] = 0x00;
  1431				rdesc[offs + 2] = 0x29;
  1432				rdesc[offs + 3] = 0xff;
  1433				rdesc[offs + 14] = 0x00;
  1434			}
  1435		}
  1436	
  1437		if (drvdata->quirks & QUIRK_G752_KEYBOARD &&
  1438			 *rsize == 75 && rdesc[61] == 0x15 && rdesc[62] == 0x00) {
  1439			/* report is missing usage minimum and maximum */
  1440			__u8 *new_rdesc;
  1441			size_t new_size = *rsize + sizeof(asus_g752_fixed_rdesc);
  1442	
  1443			new_rdesc = devm_kzalloc(&hdev->dev, new_size, GFP_KERNEL);
  1444			if (new_rdesc == NULL)
  1445				return rdesc;
  1446	
  1447			hid_info(hdev, "Fixing up Asus G752 keyb report descriptor\n");
  1448			/* copy the valid part */
  1449			memcpy(new_rdesc, rdesc, 61);
  1450			/* insert missing part */
  1451			memcpy(new_rdesc + 61, asus_g752_fixed_rdesc, sizeof(asus_g752_fixed_rdesc));
  1452			/* copy remaining data */
  1453			memcpy(new_rdesc + 61 + sizeof(asus_g752_fixed_rdesc), rdesc + 61, *rsize - 61);
  1454	
  1455			*rsize = new_size;
  1456			rdesc = new_rdesc;
  1457		}
  1458	
  1459		if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD &&
  1460				*rsize == 331 && rdesc[190] == 0x85 && rdesc[191] == 0x5a &&
  1461				rdesc[204] == 0x95 && rdesc[205] == 0x05) {
  1462			hid_info(hdev, "Fixing up Asus N-KEY keyb report descriptor\n");
  1463			rdesc[205] = 0x01;
  1464		}
  1465	
  1466		/* match many more n-key devices */
  1467		if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && *rsize > 15) {
  1468			for (int i = 0; i < *rsize - 15; i++) {
  1469				/* offset to the count from 0x5a report part always 14 */
  1470				if (rdesc[i] == 0x85 && rdesc[i + 1] == 0x5a &&
  1471				    rdesc[i + 14] == 0x95 && rdesc[i + 15] == 0x05) {
  1472					hid_info(hdev, "Fixing up Asus N-Key report descriptor\n");
  1473					rdesc[i + 15] = 0x01;
  1474					break;
  1475				}
  1476			}
  1477		}
  1478	
  1479		return rdesc;
  1480	}
  1481	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-06-11  4:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202606110526.QfgiXQTQ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hacker1024@users.sourceforge.net \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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