hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/hid/hid-lg4ff.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Force feedback support for Logitech Gaming Wheels
34 *
....@@ -8,19 +9,6 @@
89 */
910
1011 /*
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License as published by
13
- * the Free Software Foundation; either version 2 of the License, or
14
- * (at your option) any later version.
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with this program; if not, write to the Free Software
23
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2412 */
2513
2614
....@@ -103,6 +91,10 @@
10391 -1
10492 };
10593
94
+static const signed short no_wheel_effects[] = {
95
+ -1
96
+};
97
+
10698 struct lg4ff_wheel {
10799 const u32 product_id;
108100 const signed short *ff_effects;
....@@ -137,6 +129,7 @@
137129 };
138130
139131 static const struct lg4ff_wheel lg4ff_devices[] = {
132
+ {USB_DEVICE_ID_LOGITECH_WINGMAN_FG, no_wheel_effects, 40, 180, NULL},
140133 {USB_DEVICE_ID_LOGITECH_WINGMAN_FFG, lg4ff_wheel_effects, 40, 180, NULL},
141134 {USB_DEVICE_ID_LOGITECH_WHEEL, lg4ff_wheel_effects, 40, 270, NULL},
142135 {USB_DEVICE_ID_LOGITECH_MOMO_WHEEL, lg4ff_wheel_effects, 40, 270, NULL},
....@@ -346,6 +339,7 @@
346339 rd[5] = rd[3];
347340 rd[6] = 0x7F;
348341 return 1;
342
+ case USB_DEVICE_ID_LOGITECH_WINGMAN_FG:
349343 case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
350344 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
351345 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
....@@ -878,6 +872,12 @@
878872 return -ENOMEM;
879873
880874 i = strlen(lbuf);
875
+
876
+ if (i == 0) {
877
+ kfree(lbuf);
878
+ return -EINVAL;
879
+ }
880
+
881881 if (lbuf[i-1] == '\n') {
882882 if (i == 1) {
883883 kfree(lbuf);