diff mbox series

[1/2] HID: mcp2221: fix 'cast to restricted __le16' sparse warnings

Message ID 20221020153000.30874-2-matt.ranostay@konsulko.com
State Accepted
Commit e91fc483552df10291f9efac5dd9241ca129f2a4
Headers show
Series HID: mcp2221: fixes related to IIO additions | expand

Commit Message

Matt Ranostay Oct. 20, 2022, 3:29 p.m. UTC
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: 960f9df7c620 ("HID: mcp2221: add ADC/DAC support via iio subsystem")
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/hid/hid-mcp2221.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c
index b3eaf170f0ec..3014932c8cef 100644
--- a/drivers/hid/hid-mcp2221.c
+++ b/drivers/hid/hid-mcp2221.c
@@ -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