rk30: clock: clk_get_parent return error when clk invalid
author黄涛 <huangtao@rock-chips.com>
Mon, 7 May 2012 12:11:36 +0000 (20:11 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 7 May 2012 12:24:16 +0000 (20:24 +0800)
arch/arm/mach-rk30/clock.c

index 572e59e2f9edfcd574dd64410c7b92236ad136fa..6950186b5cf31cea66a1d4f9aa686eaf086c2489 100755 (executable)
@@ -445,6 +445,9 @@ struct clk *rk30_clk_get_parent(struct clk *clk)
 struct clk *clk_get_parent(struct clk *clk)
 #endif
 {
+       if (clk == NULL || IS_ERR(clk)) {
+               return ERR_PTR(-EINVAL);
+       }
        return clk->parent;
 }