Skip to content
Snippets Groups Projects
Commit 7a8d03f8 authored by Vignesh Raghavendra's avatar Vignesh Raghavendra Committed by Lokesh Vutla
Browse files

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: default avatarVignesh Raghavendra <vigneshr@ti.com>
parent 548ce227
No related branches found
No related tags found
No related merge requests found
...@@ -191,6 +191,10 @@ int k3_avs_notify_freq(int dev_id, int clk_id, u32 freq) ...@@ -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 k3_avs_privdata *priv = k3_avs_priv;
struct vd_data *vd; struct vd_data *vd;
/* Driver may not be probed yet */
if (!priv)
return -EINVAL;
for (vd = priv->vd_config->vds; vd->id >= 0; vd++) { for (vd = priv->vd_config->vds; vd->id >= 0; vd++) {
if (vd->dev_id != dev_id || vd->clk_id != clk_id) if (vd->dev_id != dev_id || vd->clk_id != clk_id)
continue; continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment