From: Chunyan Zhang Date: Tue, 19 May 2020 03:00:36 +0000 (+0800) Subject: clk: sprd: return correct type of value for _sprd_pll_recalc_rate X-Git-Tag: v5.8-rc1~69^2~6^2~4 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=c2f30986d418f26abefc2eec90ebf06716c970d2;p=linux-2.6-block.git clk: sprd: return correct type of value for _sprd_pll_recalc_rate The function _sprd_pll_recalc_rate() defines return value to unsigned long, but it would return a negative value when malloc fail, changing to return its parent_rate makes more sense, since if the callback .recalc_rate() is not set, the framework returns the parent_rate as well. Fixes: 3e37b005580b ("clk: sprd: add adjustable pll support") Signed-off-by: Chunyan Zhang Link: https://lkml.kernel.org/r/20200519030036.1785-2-zhang.lyra@gmail.com Reviewed-by: Baolin Wang Signed-off-by: Stephen Boyd --- diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c index 15791484388f..13a322b2535a 100644 --- a/drivers/clk/sprd/pll.c +++ b/drivers/clk/sprd/pll.c @@ -106,7 +106,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll, cfg = kcalloc(regs_num, sizeof(*cfg), GFP_KERNEL); if (!cfg) - return -ENOMEM; + return parent_rate; for (i = 0; i < regs_num; i++) cfg[i] = sprd_pll_read(pll, i);