]> www.infradead.org Git - users/jedix/linux-maple.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)
committerMark Brown <broonie@kernel.org>
Thu, 7 Nov 2024 13:07:17 +0000 (13:07 +0000)
commit23569c8b314925bdb70dd1a7b63cfe6100868315
tree63f4de30ae4aeac34558c1acd924bbb874692e2e
parent63c1c87993e0e5bb11bced3d8224446a2bc62338
ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()

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>
sound/soc/stm/stm32_sai_sub.c