staging: clocking-wizard: check for a valid clk_name pointer

The clk_name gets the return value from kasprintf (part of which does the
allocation of the returned buffer). So check the return pointer
before using it for clk_register_fixed_factor.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Reviewed-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Devendra Naga 2014-11-29 17:48:34 -05:00 committed by Greg Kroah-Hartman
parent 315f9a2fe2
commit 5f18611038

View File

@ -221,6 +221,11 @@ static int clk_wzrd_probe(struct platform_device *pdev)
reg = (readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)) &
WZRD_DIVCLK_DIVIDE_MASK) >> WZRD_DIVCLK_DIVIDE_SHIFT;
clk_name = kasprintf(GFP_KERNEL, "%s_mul_div", dev_name(&pdev->dev));
if (!clk_name) {
ret = -ENOMEM;
goto err_rm_int_clk;
}
clk_wzrd->clks_internal[wzrd_clk_mul_div] = clk_register_fixed_factor(
&pdev->dev, clk_name,
__clk_get_name(clk_wzrd->clks_internal[wzrd_clk_mul]),