clk: check valid clock by clk_valid()
Add valid check for clk->dev, it's useful when get optional
clock even when the clk point is valid, but its dev will be
NULL.
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 2778b50..b7e1866 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -391,7 +391,7 @@
const struct clk_ops *ops;
debug("%s(clk=%p)\n", __func__, clk);
- if (!clk)
+ if (!clk_valid(clk))
return 0;
ops = clk_dev_ops(clk->dev);
@@ -406,7 +406,7 @@
const struct clk_ops *ops;
debug("%s(clk=%p)\n", __func__, clk);
- if (!clk)
+ if (!clk_valid(clk))
return 0;
ops = clk_dev_ops(clk->dev);
@@ -422,7 +422,7 @@
struct clk *pclk;
debug("%s(clk=%p)\n", __func__, clk);
- if (!clk)
+ if (!clk_valid(clk))
return NULL;
pdev = dev_get_parent(clk->dev);
@@ -439,7 +439,7 @@
struct clk *pclk;
debug("%s(clk=%p)\n", __func__, clk);
- if (!clk)
+ if (!clk_valid(clk))
return 0;
pclk = clk_get_parent(clk);
@@ -462,7 +462,7 @@
const struct clk_ops *ops;
debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
- if (!clk)
+ if (!clk_valid(clk))
return 0;
ops = clk_dev_ops(clk->dev);
@@ -477,7 +477,7 @@
const struct clk_ops *ops;
debug("%s(clk=%p, parent=%p)\n", __func__, clk, parent);
- if (!clk)
+ if (!clk_valid(clk))
return 0;
ops = clk_dev_ops(clk->dev);
@@ -494,7 +494,7 @@
int ret;
debug("%s(clk=%p)\n", __func__, clk);
- if (!clk)
+ if (!clk_valid(clk))
return 0;
ops = clk_dev_ops(clk->dev);
@@ -554,7 +554,7 @@
int ret;
debug("%s(clk=%p)\n", __func__, clk);
- if (!clk)
+ if (!clk_valid(clk))
return 0;
ops = clk_dev_ops(clk->dev);