summaryrefslogtreecommitdiffstats
path: root/drivers/clk/pxa
diff options
context:
space:
mode:
authorXiaoke Wang <xkernel.wang@foxmail.com>2022-04-07 11:33:49 +0200
committerStephen Boyd <sboyd@kernel.org>2022-10-03 21:32:03 +0200
commit117a1542c0bc9bcce0c5b9bc63ff54dc967acdf5 (patch)
tree098e919b4635fe3ec155a9d7e9efc55ae971c7b6 /drivers/clk/pxa
parentclk: mmp: pxa168: control shared SDH bits with separate clock (diff)
downloadlinux-117a1542c0bc9bcce0c5b9bc63ff54dc967acdf5.tar.xz
linux-117a1542c0bc9bcce0c5b9bc63ff54dc967acdf5.zip
clk: pxa: add a check for 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 it to prevent potential wrong memory access. Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Link: https://lore.kernel.org/r/tencent_2B9817738F38B02844C245946EFF3B407E09@qq.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/pxa')
-rw-r--r--drivers/clk/pxa/clk-pxa.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/clk/pxa/clk-pxa.c b/drivers/clk/pxa/clk-pxa.c
index 03de634efc52..374098ebbf2b 100644
--- a/drivers/clk/pxa/clk-pxa.c
+++ b/drivers/clk/pxa/clk-pxa.c
@@ -104,6 +104,8 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks,
for (i = 0; i < nb_clks; i++) {
pxa_clk = kzalloc(sizeof(*pxa_clk), GFP_KERNEL);
+ if (!pxa_clk)
+ return -ENOMEM;
pxa_clk->is_in_low_power = clks[i].is_in_low_power;
pxa_clk->lp = clks[i].lp;
pxa_clk->hp = clks[i].hp;