Skip to content

Commit b1356ed

Browse files
claudiubezneabebarino
authored andcommitted
clk: clocking-wizard: check return value of devm_kasprintf()
devm_kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script). Fixes: 2046338 ("ARM: mxs: Use soc bus infrastructure") Signed-off-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent bd46cd0 commit b1356ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/clk/xilinx/clk-xlnx-clock-wizard.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,11 @@ static int clk_wzrd_probe(struct platform_device *pdev)
648648
}
649649

650650
clkout_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_out0", dev_name(&pdev->dev));
651+
if (!clkout_name) {
652+
ret = -ENOMEM;
653+
goto err_disable_clk;
654+
}
655+
651656
if (nr_outputs == 1) {
652657
clk_wzrd->clkout[0] = clk_wzrd_register_divider
653658
(&pdev->dev, clkout_name,

0 commit comments

Comments
 (0)