iio:imu:st_lsm6dsx: check st_lsm6dsx_shub_read_output return
authorTom Rix <trix@redhat.com>
Sun, 9 Aug 2020 17:55:51 +0000 (10:55 -0700)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 21 Sep 2020 19:01:50 +0000 (20:01 +0100)
commitf71e41e23e129640f620b65fc362a6da02580310
treed80b4f9b83aeed1975665503928de02fb5c0381c
parentd390ff735d0a61e4703bf124866ef6d4be7fdc64
iio:imu:st_lsm6dsx: check st_lsm6dsx_shub_read_output return

Potential error return is not checked.  This can lead to use
of undefined data.

Detected by clang static analysis.

st_lsm6dsx_shub.c:540:8: warning: Assigned value is garbage or undefined
        *val = (s16)le16_to_cpu(*((__le16 *)data));
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes: c91c1c844ebd ("iio: imu: st_lsm6dsx: add i2c embedded controller support")
Signed-off-by: Tom Rix <trix@redhat.com
Cc: <Stable@vger.kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200809175551.6794-1-trix@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c