Skip to content

Commit 969c765

Browse files
Charles Hanbebarino
authored andcommitted
clk: clk-apple-nco: Add NULL check in applnco_probe
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>
1 parent dedceb2 commit 969c765

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/clk/clk-apple-nco.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ static int applnco_probe(struct platform_device *pdev)
297297
memset(&init, 0, sizeof(init));
298298
init.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
299299
"%s-%d", np->name, i);
300+
if (!init.name)
301+
return -ENOMEM;
302+
300303
init.ops = &applnco_ops;
301304
init.parent_data = &pdata;
302305
init.num_parents = 1;

0 commit comments

Comments
 (0)