diff options
| author | David Lechner <[email protected]> | 2026-01-14 16:58:57 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-01-21 13:30:58 -0600 |
| commit | 80cb8a0e895d5ec835dda0ebaf14e293b4039c60 (patch) | |
| tree | 6d1df9cf7433ab9ac2c8950abaf9716b372e2b9e /drivers | |
| parent | 04413ed0c1bde24bdb4a15e5d75a33f1f3fa8bfa (diff) | |
clk: mtk: use IS_ERR_VALUE() to check rate return values
Replace casting with long to IS_ERR_VALUE() macro to check for error
return values from rate calculation functions. This is the recommended
way to check the return value from clock rate functions.
Signed-off-by: David Lechner <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/clk/mediatek/clk-mtk.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index acc28d1da1a..b4de38719e1 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -12,6 +12,7 @@ #include <asm/io.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/err.h> #include "clk-mtk.h" @@ -236,10 +237,10 @@ static void mtk_clk_print_rate(struct udevice *dev, int mapped_id) .dev = dev, .id = mapped_id, }; - long rate = clk_get_rate(&clk); + ulong rate = clk_get_rate(&clk); - if (rate < 0) - printf(", error! clk_get_rate() failed: %ld", rate); + if (IS_ERR_VALUE(rate)) + printf(", error! clk_get_rate() failed: %d", (int)rate); else printf(", Rate: %lu Hz", rate); } @@ -650,7 +651,7 @@ static ulong mtk_topckgen_get_factor_rate(struct clk *clk, u32 off) rate = priv->tree->xtal_rate; } - if (((long)rate) < 0) + if (IS_ERR_VALUE(rate)) return rate; return mtk_factor_recalc_rate(fdiv, rate); @@ -974,7 +975,7 @@ static ulong mtk_infrasys_get_factor_rate(struct clk *clk, u32 off) rate = mtk_clk_find_parent_rate(clk, fdiv->parent, NULL); } - if (((long)rate) < 0) + if (IS_ERR_VALUE(rate)) return rate; return mtk_factor_recalc_rate(fdiv, rate); |
