]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
ARM: SAMSUNG: Add check for NULL in clock interface
authorChander Kashyap <chander.kashyap@linaro.org>
Fri, 21 Sep 2012 02:08:32 +0000 (11:08 +0900)
committerKukjin Kim <kgene.kim@samsung.com>
Fri, 21 Sep 2012 02:08:32 +0000 (11:08 +0900)
The clock instance parameter in Samsung clock interface is not being checked
for NULL pointers. Add checks for NULL pointers.

Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Acked-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/plat-samsung/clock.c

index 65c5eca475e76ef839a16aaef568173a2dc0ee1c..7938fbce825e3052dc62f3a413e84b7aa0a887b5 100644 (file)
@@ -119,7 +119,7 @@ void clk_disable(struct clk *clk)
 
 unsigned long clk_get_rate(struct clk *clk)
 {
-       if (IS_ERR(clk))
+       if (IS_ERR_OR_NULL(clk))
                return 0;
 
        if (clk->rate != 0)
@@ -136,7 +136,7 @@ unsigned long clk_get_rate(struct clk *clk)
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
-       if (!IS_ERR(clk) && clk->ops && clk->ops->round_rate)
+       if (!IS_ERR_OR_NULL(clk) && clk->ops && clk->ops->round_rate)
                return (clk->ops->round_rate)(clk, rate);
 
        return rate;
@@ -146,7 +146,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 {
        int ret;
 
-       if (IS_ERR(clk))
+       if (IS_ERR_OR_NULL(clk))
                return -EINVAL;
 
        /* We do not default just do a clk->rate = rate as
@@ -175,7 +175,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 {
        int ret = 0;
 
-       if (IS_ERR(clk))
+       if (IS_ERR_OR_NULL(clk) || IS_ERR_OR_NULL(parent))
                return -EINVAL;
 
        spin_lock(&clocks_lock);