]> git.baikalelectronics.ru Git - kernel.git/commit
iio: magnetometer: yas530: Fix memchr_inv() misuse
authorLinus Walleij <linus.walleij@linaro.org>
Sun, 1 May 2022 19:50:29 +0000 (21:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jun 2022 07:03:26 +0000 (09:03 +0200)
commitf585ee1975d16f0d509921a17eb35027ae2c0024
tree5e68280f003573f0e44e0c3a407b6e9a500f0e44
parent9c666cb716b83af023cc10320fa3c44f1ef1dda2
iio: magnetometer: yas530: Fix memchr_inv() misuse

[ Upstream commit 6ae168cdc3dc13499ba6a21095e040aeb318a8d0 ]

The call to check if the calibration is all zeroes is doing
it wrong: memchr_inv() returns NULL if the the calibration
contains all zeroes, but the check is for != NULL.

Fix it up. It's probably not an urgent fix because the inner
check for BIT(7) in data[13] will save us. But fix it.

Fixes: 9e5aa8e4e18b ("iio: magnetometer: Add driver for Yamaha YAS530")
Reported-by: Jakob Hauser <jahau@rocketmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220501195029.151852-1-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/magnetometer/yamaha-yas530.c