Skip to content

Commit

Permalink
HID: mcp2221: fix 'cast to restricted __le16' sparse warnings
Browse files Browse the repository at this point in the history
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 <lkp@intel.com>
Fixes: 960f9df ("HID: mcp2221: add ADC/DAC support via iio subsystem")
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Matt Ranostay authored and Jiri Kosina committed Oct 21, 2022
1 parent daf405c commit e91fc48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hid-mcp2221.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ static int mcp2221_read_raw(struct iio_dev *indio_dev,
ret = mcp_chk_last_cmd_status(mcp);

if (!ret) {
*val = le16_to_cpu(mcp->adc_values[channel->address]);
*val = le16_to_cpu((__force __le16) mcp->adc_values[channel->address]);
if (*val >= BIT(10))
ret = -EINVAL;
else
Expand Down

0 comments on commit e91fc48

Please sign in to comment.