diff options
author | Xiaoke Wang <xkernel.wang@foxmail.com> | 2022-03-25 19:49:41 +0800 |
---|---|---|
committer | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 2022-03-30 20:25:48 +0200 |
commit | 34123208bbcc8c884a0489f543a23fe9eebb5514 (patch) | |
tree | bbf316f4fad2183dd5c020dbadef27668b653640 /arch/mips/lantiq/falcon/sysctrl.c | |
parent | f93e2a100ee73a4b84d96d7d1881baaac36e586e (diff) | |
download | linux-34123208bbcc8c884a0489f543a23fe9eebb5514.tar.gz linux-34123208bbcc8c884a0489f543a23fe9eebb5514.tar.bz2 linux-34123208bbcc8c884a0489f543a23fe9eebb5514.zip |
MIPS: lantiq: check the return value of kzalloc()
kzalloc() is a memory allocation function which can return NULL when
some internal memory errors happen. So it is better to check the
return value of it to prevent potential wrong memory access or
memory leak.
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/lantiq/falcon/sysctrl.c')
-rw-r--r-- | arch/mips/lantiq/falcon/sysctrl.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/mips/lantiq/falcon/sysctrl.c b/arch/mips/lantiq/falcon/sysctrl.c index 64726c670ca6..5204fc6d6d50 100644 --- a/arch/mips/lantiq/falcon/sysctrl.c +++ b/arch/mips/lantiq/falcon/sysctrl.c @@ -167,6 +167,8 @@ static inline void clkdev_add_sys(const char *dev, unsigned int module, { struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); + if (!clk) + return; clk->cl.dev_id = dev; clk->cl.con_id = NULL; clk->cl.clk = clk; |