Skip to content

Commit

Permalink
ARM: SAMSUNG: Add check for NULL in clock interface
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chander Kashyap authored and Kukjin Kim committed Sep 21, 2012
1 parent 377acfb commit 13acc29
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/arm/plat-samsung/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 13acc29

Please sign in to comment.