Skip to content

Commit 5fe2ccb

Browse files
xiongzhongjiangJiri Kosina
authored andcommitted
HID: logitech: fix a used uninitialized GCC warning
Fix the following compile warning: drivers/hid/hid-logitech-hidpp.c: In function 'hi_res_scroll_enable': drivers/hid/hid-logitech-hidpp.c:2714:54: warning: 'multiplier' may be used uninitialized in this function [-Wmaybe-uninitialized] hidpp->vertical_wheel_counter.resolution_multiplier = multiplier; Signed-off-by: zhong jiang <zhongjiang@huawei.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 3fe1d6b commit 5fe2ccb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/hid/hid-logitech-hidpp.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,6 @@ static int hidpp_hrw_get_wheel_capability(struct hidpp_device *hidpp,
12311231
*multiplier = response.fap.params[0];
12321232
return 0;
12331233
return_default:
1234-
*multiplier = 8;
12351234
hid_warn(hidpp->hid_dev,
12361235
"Couldn't get wheel multiplier (error %d), assuming %d.\n",
12371236
ret, *multiplier);
@@ -2696,18 +2695,17 @@ static int hi_res_scroll_look_up_microns(__u32 product_id)
26962695
static int hi_res_scroll_enable(struct hidpp_device *hidpp)
26972696
{
26982697
int ret;
2699-
u8 multiplier;
2698+
u8 multiplier = 8;
27002699

27012700
if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_X2121) {
27022701
ret = hidpp_hrw_set_wheel_mode(hidpp, false, true, false);
27032702
hidpp_hrw_get_wheel_capability(hidpp, &multiplier);
27042703
} else if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_X2120) {
27052704
ret = hidpp_hrs_set_highres_scrolling_mode(hidpp, true,
27062705
&multiplier);
2707-
} else /* if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_1P0) */ {
2706+
} else /* if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_1P0) */
27082707
ret = hidpp10_enable_scrolling_acceleration(hidpp);
2709-
multiplier = 8;
2710-
}
2708+
27112709
if (ret)
27122710
return ret;
27132711

0 commit comments

Comments
 (0)