summaryrefslogtreecommitdiff
path: root/drivers/staging/clocking-wizard
diff options
context:
space:
mode:
authorDevendra Naga <devendra.aaru@gmail.com>2014-11-30 01:48:34 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-12-03 03:45:24 +0300
commit5f18611038f9c9d503318490069b730c942523f8 (patch)
tree1808c89ed4acb0a157774adde6a453c7b4156ddb /drivers/staging/clocking-wizard
parent315f9a2fe237c81535695005592eb7c586f3181e (diff)
downloadlinux-5f18611038f9c9d503318490069b730c942523f8.tar.xz
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>
Diffstat (limited to 'drivers/staging/clocking-wizard')
-rw-r--r--drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c b/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c
index 7202d8e889aa..0a3a8fe67fb5 100644
--- a/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c
+++ b/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c
@@ -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]),