Skip to content

Commit

Permalink
interconnect: Check for valid path in icc_set_bw()
Browse files Browse the repository at this point in the history
Use IS_ERR() to ensure that the path passed to icc_set_bw() is valid.

Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
  • Loading branch information
Georgi Djakov committed Jan 7, 2020
1 parent 2c5127a commit 7d7899c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/interconnect/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,12 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
size_t i;
int ret;

if (!path || !path->num_nodes)
if (!path)
return 0;

if (WARN_ON(IS_ERR(path) || !path->num_nodes))
return -EINVAL;

mutex_lock(&icc_lock);

old_avg = path->reqs[0].avg_bw;
Expand Down

0 comments on commit 7d7899c

Please sign in to comment.