diff mbox series

[v2,01/21] clk: check hw and hw->dev before dereference it

Message ID 1596640325-20014-2-git-send-email-claudiu.beznea@microchip.com
State Superseded
Delegated to: Eugen Hristev
Headers show
Series clk: at91: add sama7g5 support | expand

Commit Message

Claudiu Beznea Aug. 5, 2020, 3:11 p.m. UTC
Check hw and hw->dev before dereference it.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/clk.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass Aug. 16, 2020, 3:39 a.m. UTC | #1
On Wed, 5 Aug 2020 at 09:12, Claudiu Beznea
<claudiu.beznea@microchip.com> wrote:
>
> Check hw and hw->dev before dereference it.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
>  drivers/clk/clk.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0f55ba751c0f..56ae1e7e265f 100644
--- a/drivers/clk/clk.c
+++ b/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;
 }