Re: [PATCH v2 5/5] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer

From: Andy Shevchenko
Date: Sat Apr 22 2023 - 12:09:25 EST


On Sat, Apr 22, 2023 at 07:19:44AM +0800, kernel test robot wrote:
> Hi Mehdi,
>
> kernel test robot noticed the following build warnings:

I believe it's not just a warning, it's a full functional error in the code.

> 686 {
> 687 struct device *dev = regmap_get_device(data->regmap);
> 688 __le16 buf_status;
> 689 int ret, fifo_bytes;
> 690
> 691 ret = regmap_bulk_read(data->regmap, data->chip_info->buf_status1,
> 692 &buf_status, sizeof(buf_status));
> 693 if (ret) {
> 694 dev_err(dev, "Error reading buffer status\n");
> 695 return ret;
> 696 }
> 697
> > 698 buf_status &= data->chip_info->buf_smp_lvl_mask;
> 699 fifo_bytes = le16_to_cpu(buf_status);

You need to mask in the same endianess space, i.o.w. either on CPU or device side.

I believe you wanted to have fifo_bytes to be masked, but I'm not sure.

> 701 return fifo_bytes;
> 702 }

--
With Best Regards,
Andy Shevchenko