Commit d2080a87 authored by Jonathan Cameron's avatar Jonathan Cameron

iio: proximity: pulsedlight v2: Tidy up an endian issue

Sparse identified the following
CHECK   drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16

This cleans up by adding a local variable to hold the value whilst
it is __be16 before applying endian converstion into eventual destination.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
parent 6b943a6f
......@@ -136,12 +136,13 @@ static inline int lidar_write_power(struct lidar_data *data, int val)
static int lidar_read_measurement(struct lidar_data *data, u16 *reg)
{
__be16 value;
int ret = data->xfer(data, LIDAR_REG_DATA_HBYTE |
(data->i2c_enabled ? LIDAR_REG_DATA_WORD_READ : 0),
(u8 *) reg, 2);
(u8 *) &value, 2);
if (!ret)
*reg = be16_to_cpu(*reg);
*reg = be16_to_cpu(value);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment