Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: ath79: Fix test for error return of clk_register_fixed_factor().

clk_register_fixed_factor returns an ERR_PTR in case of an error and
should have an IS_ERR check instead of a null check.

The Coccinelle semantic patch used to find this issue is as follows:
@@
expression e;
statement S;
@@

*e = clk_register_fixed_factor(...);
if (!e) S

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Cc: julia.lawall@lip6.fr
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/13894/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Amitoj Kaur Chawla and committed by
Ralf Baechle
e3b23148 9395452b

+1 -1
+1 -1
arch/mips/ath79/clock.c
··· 96 96 struct clk *clk; 97 97 98 98 clk = clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div); 99 - if (!clk) 99 + if (IS_ERR(clk)) 100 100 panic("failed to allocate %s clock structure", name); 101 101 102 102 return clk;