If LOG_DEBUG is defined and a NULL clk is passed to clk_enable or
clk_disable then an attempt is made to dereference NULL in the debug
statement. Guard against this.

Signed-off-by: Andrew Goodbody <[email protected]>
---
 drivers/clk/clk-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 
3dbe1ce9441ca513d41be90520ff175c96b4253a..1f55dbe385b76d0d6cfbf19bc9f4f1abe619baf2
 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -660,7 +660,7 @@ int clk_enable(struct clk *clk)
        struct clk *clkp = NULL;
        int ret;
 
-       debug("%s(clk=%p name=%s)\n", __func__, clk, clk->dev->name);
+       debug("%s(clk=%p name=%s)\n", __func__, clk, clk ? clk->dev->name : 
"NULL");
        if (!clk_valid(clk))
                return 0;
        ops = clk_dev_ops(clk->dev);
@@ -721,7 +721,7 @@ int clk_disable(struct clk *clk)
        struct clk *clkp = NULL;
        int ret;
 
-       debug("%s(clk=%p name=%s)\n", __func__, clk, clk->dev->name);
+       debug("%s(clk=%p name=%s)\n", __func__, clk, clk ? clk->dev->name : 
"NULL");
        if (!clk_valid(clk))
                return 0;
        ops = clk_dev_ops(clk->dev);

-- 
2.47.3

Reply via email to