Skip to content

Commit e91fc48

Browse files
mranostayJiri Kosina
authored andcommitted
HID: mcp2221: fix 'cast to restricted __le16' sparse warnings
Use (__force __le16) cast for adc_values le16_to_cpu conversion to correct following sparse warnings: drivers/hid/hid-mcp2221.c:950:32: sparse: sparse: cast to restricted __le16 Reported-by: kernel test robot <[email protected]> Fixes: 960f9df ("HID: mcp2221: add ADC/DAC support via iio subsystem") Signed-off-by: Matt Ranostay <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent daf405c commit e91fc48

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hid/hid-mcp2221.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ static int mcp2221_read_raw(struct iio_dev *indio_dev,
950950
ret = mcp_chk_last_cmd_status(mcp);
951951

952952
if (!ret) {
953-
*val = le16_to_cpu(mcp->adc_values[channel->address]);
953+
*val = le16_to_cpu((__force __le16) mcp->adc_values[channel->address]);
954954
if (*val >= BIT(10))
955955
ret = -EINVAL;
956956
else

0 commit comments

Comments
 (0)