Commit 13acc291 authored by Chander Kashyap's avatar Chander Kashyap Committed by Kukjin Kim

ARM: SAMSUNG: Add check for NULL in clock interface

The clock instance parameter in Samsung clock interface is not being checked
for NULL pointers. Add checks for NULL pointers.
Signed-off-by: default avatarChander Kashyap <chander.kashyap@linaro.org>
Acked-by: default avatarThomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent 377acfbb
...@@ -119,7 +119,7 @@ void clk_disable(struct clk *clk) ...@@ -119,7 +119,7 @@ void clk_disable(struct clk *clk)
unsigned long clk_get_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk)
{ {
if (IS_ERR(clk)) if (IS_ERR_OR_NULL(clk))
return 0; return 0;
if (clk->rate != 0) if (clk->rate != 0)
...@@ -136,7 +136,7 @@ unsigned long clk_get_rate(struct clk *clk) ...@@ -136,7 +136,7 @@ unsigned long clk_get_rate(struct clk *clk)
long clk_round_rate(struct clk *clk, unsigned long rate) 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 (clk->ops->round_rate)(clk, rate);
return rate; return rate;
...@@ -146,7 +146,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) ...@@ -146,7 +146,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
{ {
int ret; int ret;
if (IS_ERR(clk)) if (IS_ERR_OR_NULL(clk))
return -EINVAL; return -EINVAL;
/* We do not default just do a clk->rate = rate as /* 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) ...@@ -175,7 +175,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
{ {
int ret = 0; int ret = 0;
if (IS_ERR(clk)) if (IS_ERR_OR_NULL(clk) || IS_ERR_OR_NULL(parent))
return -EINVAL; return -EINVAL;
spin_lock(&clocks_lock); spin_lock(&clocks_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment