Explorar el Código

clk: check hw and hw->dev before dereference it

Check hw and hw->dev before dereference it.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Claudiu Beznea hace 3 años
padre
commit
b04da9fcf7
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      drivers/clk/clk.c

+ 3 - 0
drivers/clk/clk.c

@@ -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;
 }