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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Martin Povišer <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent dedceb2 commit 969c765

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)