]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()
authorLuo Yifan <luoyifan@cmss.chinamobile.com>
Wed, 6 Nov 2024 01:46:54 +0000 (09:46 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 7 Nov 2024 13:07:16 +0000 (13:07 +0000)
commit63c1c87993e0e5bb11bced3d8224446a2bc62338
tree74e08cd27f9cd7f83472e208ec3af3fd29dfefdd
parent8c21e40e1e481f7fef6e570089e317068b972c45
ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()

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 (*prate / div) is safe to perform.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
Link: https://patch.msgid.link/20241106014654.206860-1-luoyifan@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/stm/stm32_sai_sub.c