clk: s2mps11: Fix possible NULL pointer dereference
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Fri, 21 Mar 2014 12:18:17 +0000 (13:18 +0100)
committerMike Turquette <mturquette@linaro.org>
Mon, 24 Mar 2014 22:11:27 +0000 (15:11 -0700)
If parent device does not have of_node set the s2mps11_clk_parse_dt()
returned NULL. This NULL was later passed to of_clk_add_provider() which
dereferenced it in pr_debug() call.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/clk-s2mps11.c

index f4c1f0881b6c55cb4b589ba2a3516cacfccdf82e..10e66e90d81cb24e59ca7e6196d6b9ea90dcb724 100644 (file)
@@ -132,7 +132,7 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
        int i;
 
        if (!iodev->dev->of_node)
-               return NULL;
+               return ERR_PTR(-EINVAL);
 
        clk_np = of_find_node_by_name(iodev->dev->of_node, "clocks");
        if (!clk_np) {