clk: check hw and hw->dev before dereference it
authorClaudiu Beznea <claudiu.beznea@microchip.com>
Mon, 7 Sep 2020 14:46:32 +0000 (17:46 +0300)
committerEugen Hristev <eugen.hristev@microchip.com>
Tue, 22 Sep 2020 08:27:18 +0000 (11:27 +0300)
Check hw and hw->dev before dereference it.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/clk/clk.c

index 786f4e8..319808d 100644 (file)
@@ -57,6 +57,9 @@ ulong clk_generic_get_rate(struct clk *clk)
 
 const char *clk_hw_get_name(const struct clk *hw)
 {
+       assert(hw);
+       assert(hw->dev);
+
        return hw->dev->name;
 }