]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()
authorLuo Yifan <luoyifan@cmss.chinamobile.com>
Thu, 7 Nov 2024 01:59:36 +0000 (09:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:50:41 +0000 (19:50 +0100)
commit3727c0bf74eb57af12990641a0579d9e9afa6daa
tree1bfcbe3a7bb62bfc06a2ec1af17c596aa3606e6a
parent80c35a870ea3121057669979a15e93ffa39911fc
ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()

[ Upstream commit 23569c8b314925bdb70dd1a7b63cfe6100868315 ]

This patch checks if div is less than or equal to zero (div <= 0). If
div is zero or negative, the function returns -EINVAL, ensuring the
division operation is safe to perform.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
Reviewed-by: Olivier Moysan <olivier.moysan@foss.st.com>
Link: https://patch.msgid.link/20241107015936.211902-1-luoyifan@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/stm/stm32_sai_sub.c