OSDN Git Service

Staging: iio: Change data type to u16 to avoid unnecessary typecast
authorSomya Anand <somyaanand214@gmail.com>
Sat, 7 Mar 2015 17:50:01 +0000 (23:20 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Mar 2015 12:18:04 +0000 (13:18 +0100)
commitb62a569e4ae2361bac6f601e75aa973d42d7c47d
tree405adf30b53e253f5971a530649a2610a059a900
parent355a73f07d1da405728c9e57afd6eede340788f4
Staging: iio: Change data type to u16 to avoid unnecessary typecast

In the adis16220_read16bit() function we earlier used a s16 value 'val'
which is used by the adis_read_reg_16 function to read data and takes a
u16 value as a parameter.

So, this patch changes the data type of 'val' from s16 to u16. It is safe
to remove the extra sign extension, since the user of the function uses it
to read a 10 unsigned value which will lead to the same result in both cases.
Further this patch removes the unnecessary typecast for the simplification of
code. In addition to this, initialization of 'val' to 0 is also dropped. This is
due to the fact that not initializing helps the compiler provide useful warnings
if the code gets changed to return an otherwise uninitialized result.

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/accel/adis16220_core.c