]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: accel: mma8452: Ensure error return on failure to matching oversampling ratio
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 Feb 2025 14:01:28 +0000 (14:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:32:01 +0000 (14:32 +0200)
commit7041fafd0dc69c1d1429637c9c717418bde85a8d
tree8765d0a67d77cc57b72dd715538e21b88a68745f
parent473362787faf4def2f52d08a928381d761484601
iio: accel: mma8452: Ensure error return on failure to matching oversampling ratio

[ Upstream commit df330c808182a8beab5d0f84a6cbc9cff76c61fc ]

If a match was not found, then the write_raw() callback would return
the odr index, not an error. Return -EINVAL if this occurs.
To avoid similar issues in future, introduce j, a new indexing variable
rather than using ret for this purpose.

Fixes: 79de2ee469aa ("iio: accel: mma8452: claim direct mode during write raw")
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250217140135.896574-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/accel/mma8452.c