[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202212231433.9ZzQA475-lkp@intel.com>
Date: Fri, 23 Dec 2022 14:04:30 +0300
From: Dan Carpenter <error27@...il.com>
To: oe-kbuild@...ts.linux.dev,
Roderick Colenbrander <roderick@...kai.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, Jiri Kosina <jkosina@...e.cz>
Subject: drivers/hid/hid-playstation.c:1766 dualshock4_get_calibration_data()
warn: ignoring unreachable code.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8395ae05cb5a2e31d36106e8c85efa11cda849be
commit: c64ed0cd9324f9e5f44deb6834ad9fb5bfa436bc HID: playstation: add DualShock4 dongle support.
config: parisc-randconfig-m041-20221219
compiler: hppa-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>
New smatch warnings:
drivers/hid/hid-playstation.c:1766 dualshock4_get_calibration_data() warn: ignoring unreachable code.
Old smatch warnings:
drivers/hid/hid-playstation.c:1923 dualshock4_get_mac_address() error: uninitialized symbol 'buf'.
vim +1766 drivers/hid/hid-playstation.c
12882ed83c5833 Roderick Colenbrander 2022-10-29 1727 static int dualshock4_get_calibration_data(struct dualshock4 *ds4)
12882ed83c5833 Roderick Colenbrander 2022-10-29 1728 {
12882ed83c5833 Roderick Colenbrander 2022-10-29 1729 struct hid_device *hdev = ds4->base.hdev;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1730 short gyro_pitch_bias, gyro_pitch_plus, gyro_pitch_minus;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1731 short gyro_yaw_bias, gyro_yaw_plus, gyro_yaw_minus;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1732 short gyro_roll_bias, gyro_roll_plus, gyro_roll_minus;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1733 short gyro_speed_plus, gyro_speed_minus;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1734 short acc_x_plus, acc_x_minus;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1735 short acc_y_plus, acc_y_minus;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1736 short acc_z_plus, acc_z_minus;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1737 int speed_2x;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1738 int range_2g;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1739 int ret = 0;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1740 uint8_t *buf;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1741
2d77474a239294 Roderick Colenbrander 2022-10-29 1742 if (ds4->base.hdev->bus == BUS_USB) {
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1743 int retries;
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1744
12882ed83c5833 Roderick Colenbrander 2022-10-29 1745 buf = kzalloc(DS4_FEATURE_REPORT_CALIBRATION_SIZE, GFP_KERNEL);
12882ed83c5833 Roderick Colenbrander 2022-10-29 1746 if (!buf)
12882ed83c5833 Roderick Colenbrander 2022-10-29 1747 return -ENOMEM;
12882ed83c5833 Roderick Colenbrander 2022-10-29 1748
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1749 /* We should normally receive the feature report data we asked
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1750 * for, but hidraw applications such as Steam can issue feature
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1751 * reports as well. In particular for Dongle reconnects, Steam
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1752 * and this function are competing resulting in often receiving
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1753 * data for a different HID report, so retry a few times.
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1754 */
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1755 for (retries = 0; retries < 3; retries++) {
12882ed83c5833 Roderick Colenbrander 2022-10-29 1756 ret = ps_get_report(hdev, DS4_FEATURE_REPORT_CALIBRATION, buf,
a23b063b84d0d5 Roderick Colenbrander 2022-10-29 1757 DS4_FEATURE_REPORT_CALIBRATION_SIZE, true);
12882ed83c5833 Roderick Colenbrander 2022-10-29 1758 if (ret) {
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1759 if (retries < 2) {
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1760 hid_warn(hdev, "Retrying DualShock 4 get calibration report (0x02) request\n");
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1761 continue;
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1762 } else {
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1763 ret = -EILSEQ;
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1764 goto err_free;
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1765 }
12882ed83c5833 Roderick Colenbrander 2022-10-29 @1766 hid_err(hdev, "Failed to retrieve DualShock4 calibration info: %d\n", ret);
This is dead code.
12882ed83c5833 Roderick Colenbrander 2022-10-29 1767 goto err_free;
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1768 } else {
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1769 break;
c64ed0cd9324f9 Roderick Colenbrander 2022-10-29 1770 }
12882ed83c5833 Roderick Colenbrander 2022-10-29 1771 }
2d77474a239294 Roderick Colenbrander 2022-10-29 1772 } else { /* Bluetooth */
2d77474a239294 Roderick Colenbrander 2022-10-29 1773 buf = kzalloc(DS4_FEATURE_REPORT_CALIBRATION_BT_SIZE, GFP_KERNEL);
2d77474a239294 Roderick Colenbrander 2022-10-29 1774 if (!buf)
2d77474a239294 Roderick Colenbrander 2022-10-29 1775 return -ENOMEM;
2d77474a239294 Roderick Colenbrander 2022-10-29 1776
2d77474a239294 Roderick Colenbrander 2022-10-29 1777 ret = ps_get_report(hdev, DS4_FEATURE_REPORT_CALIBRATION_BT, buf,
2d77474a239294 Roderick Colenbrander 2022-10-29 1778 DS4_FEATURE_REPORT_CALIBRATION_BT_SIZE, true);
2d77474a239294 Roderick Colenbrander 2022-10-29 1779 if (ret) {
2d77474a239294 Roderick Colenbrander 2022-10-29 1780 hid_err(hdev, "Failed to retrieve DualShock4 calibration info: %d\n", ret);
2d77474a239294 Roderick Colenbrander 2022-10-29 1781 goto err_free;
2d77474a239294 Roderick Colenbrander 2022-10-29 1782 }
2d77474a239294 Roderick Colenbrander 2022-10-29 1783 }
12882ed83c5833 Roderick Colenbrander 2022-10-29 1784
12882ed83c5833 Roderick Colenbrander 2022-10-29 1785 gyro_pitch_bias = get_unaligned_le16(&buf[1]);
12882ed83c5833 Roderick Colenbrander 2022-10-29 1786 gyro_yaw_bias = get_unaligned_le16(&buf[3]);
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists