Skip to content

Commit

Permalink
clk: clk-apple-nco: Add NULL check in applnco_probe
Browse files Browse the repository at this point in the history
Add NULL check in applnco_probe, to handle kernel NULL pointer
dereference error.

Fixes: 6641057 ("clk: clk-apple-nco: Add driver for Apple NCO")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://lore.kernel.org/r/20241114072820.3071-1-hanchunchao@inspur.com
Reviewed-by: Martin Povišer <povik+lin@cutebit.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
  • Loading branch information
Charles Han authored and Stephen Boyd committed Nov 14, 2024
1 parent dedceb2 commit 969c765
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/clk/clk-apple-nco.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ static int applnco_probe(struct platform_device *pdev)
memset(&init, 0, sizeof(init));
init.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
"%s-%d", np->name, i);
if (!init.name)
return -ENOMEM;

init.ops = &applnco_ops;
init.parent_data = &pdata;
init.num_parents = 1;
Expand Down

0 comments on commit 969c765

Please sign in to comment.