]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
iio: imu: adis: assign value only if return code zero in read funcs
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Fri, 1 Nov 2019 09:35:05 +0000 (11:35 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 3 Nov 2019 10:47:42 +0000 (10:47 +0000)
commitc49cfc227e7f49e6011d6b955145814ce13424bc
tree8c13f5e07894112d7b4844a89049062b62754991
parent38262c01ead40f2b061e8b7e6abe254b538d856c
iio: imu: adis: assign value only if return code zero in read funcs

The inline read functions in the ADIS library don't check the return value
of the `adis_read_reg()` function and assign the value of `tmp` regardless.

Fix this by checking if return value is zero and only then assigning the
value of `tmp`.

No known case of the callers of this function incorrectly using the
value, but best to stop any potential risk here.
Not suitable for stable due to no known actual bugs caused by this
issue.

Fixes: 57a1228a06b7a ("iio:imu:adis: Add support for 32bit registers")
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
include/linux/iio/imu/adis.h