pwm: meson: Add check for error from clk_round_rate()
authorGeorge Stark <gnstark@salutedevices.com>
Thu, 25 Apr 2024 17:12:52 +0000 (20:12 +0300)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 30 Apr 2024 16:57:08 +0000 (18:57 +0200)
commit3e551115aee079931b82e1ec78c05f3d5033473f
treeba150f6cfa88b306603e9d9d47145788c90c8807
parent6b2d60a543c4ffbb6bd9703a2714b2d5fbfc5781
pwm: meson: Add check for error from clk_round_rate()

clk_round_rate() can return not only zero if requested frequency can not
be provided but also negative error code so add check for it too.

Also change type of variable holding clk_round_rate() result from
unsigned long to long. It's safe due to clk_round_rate() returns long.

Fixes: 329db102a26d ("pwm: meson: make full use of common clock framework")
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
Signed-off-by: George Stark <gnstark@salutedevices.com>
Link: https://lore.kernel.org/r/20240425171253.2752877-3-gnstark@salutedevices.com
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
drivers/pwm/pwm-meson.c