media: meson-ir-tx: Prevent divide by zero in meson_irtx_prepare_pulse()

If an excesively high carrier is set, meson_irtx_prepare_pulse() will
cause a divide by zero if tb_us is 0. Prevent such a carrier from being
set.

Fixes: 49be1c78d5 ("media: rc: introduce Meson IR TX driver")
Signed-off-by: Sean Young <sean@mess.org>
Cc: stable@vger.kernel.org
Acked-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Sean Young 2026-09-09 11:04:40 +01:00
parent 27303392aa
commit 05d9c515cf

View File

@ -219,6 +219,9 @@ static int meson_irtx_set_carrier(struct rc_dev *rc, u32 carrier)
if (carrier == 0)
return -EINVAL;
if (!DIV_ROUND_CLOSEST(USEC_PER_SEC, carrier))
return -EINVAL;
ir->carrier = carrier;
meson_irtx_set_mod(ir);