Message ID | 1623749970-38020-2-git-send-email-yang.lee@linux.alibaba.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | [-next,1/2] clk: renesas: Remove unneeded semicolon | expand |
Hi Yang, On Tue, Jun 15, 2021 at 11:39 AM Yang Li <yang.lee@linux.alibaba.com> wrote: > Currently the function returns NULL on error, so exact error code is lost. > This patch changes return convention of the function to use ERR_PTR() > on error instead. > > Reported-by: Abaci Robot <abaci@linux.alibaba.com> > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> > --- > drivers/clk/renesas/renesas-rzg2l-cpg.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c > index 1fcea17..5bc7e87 100644 > --- a/drivers/clk/renesas/renesas-rzg2l-cpg.c > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c > @@ -183,7 +183,7 @@ static unsigned long rzg2l_cpg_pll_clk_recalc_rate(struct clk_hw *hw, > pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); > if (!pll_clk) { > clk = ERR_PTR(-ENOMEM); > - return NULL; > + return clk; > } Why not simply "return ERR_PTR(-ENOMEM);"? Gr{oetje,eeting}s, Geert
diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c index 1fcea17..5bc7e87 100644 --- a/drivers/clk/renesas/renesas-rzg2l-cpg.c +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c @@ -183,7 +183,7 @@ static unsigned long rzg2l_cpg_pll_clk_recalc_rate(struct clk_hw *hw, pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); if (!pll_clk) { clk = ERR_PTR(-ENOMEM); - return NULL; + return clk; } parent_name = __clk_get_name(parent);
Currently the function returns NULL on error, so exact error code is lost. This patch changes return convention of the function to use ERR_PTR() on error instead. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> --- drivers/clk/renesas/renesas-rzg2l-cpg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)