diff options
author | Vignesh Raghavendra <vigneshr@ti.com> | 2020-02-14 17:52:17 +0530 |
---|---|---|
committer | Lokesh Vutla <lokeshvutla@ti.com> | 2020-02-26 18:35:29 +0530 |
commit | 7a8d03f88efadcfe5963bc72a03fedc9a04f7f5a (patch) | |
tree | ee8d8dd8993ad3bb2b599fd13e6c14e2132ea80f /drivers/misc | |
parent | 548ce227d3d852455c6395c0cec30af0cda77b09 (diff) | |
download | u-boot-7a8d03f88efadcfe5963bc72a03fedc9a04f7f5a.tar.gz |
misc: k3_avs: Fix possible NULL pointer deference
Its possible that k3_avs_priv is NULL because the driver may not have
been probed yet. Therefore check if pointer is valid before
dereferencing it.
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/k3_avs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c index 47e42738e0..90df377250 100644 --- a/drivers/misc/k3_avs.c +++ b/drivers/misc/k3_avs.c @@ -191,6 +191,10 @@ int k3_avs_notify_freq(int dev_id, int clk_id, u32 freq) struct k3_avs_privdata *priv = k3_avs_priv; struct vd_data *vd; + /* Driver may not be probed yet */ + if (!priv) + return -EINVAL; + for (vd = priv->vd_config->vds; vd->id >= 0; vd++) { if (vd->dev_id != dev_id || vd->clk_id != clk_id) continue; |