Skip to content

Commit 7d7899c

Browse files
author
Georgi Djakov
committed
interconnect: Check for valid path in icc_set_bw()
Use IS_ERR() to ensure that the path passed to icc_set_bw() is valid. Reviewed-by: Evan Green <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Georgi Djakov <[email protected]>
1 parent 2c5127a commit 7d7899c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/interconnect/core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,12 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
495495
size_t i;
496496
int ret;
497497

498-
if (!path || !path->num_nodes)
498+
if (!path)
499499
return 0;
500500

501+
if (WARN_ON(IS_ERR(path) || !path->num_nodes))
502+
return -EINVAL;
503+
501504
mutex_lock(&icc_lock);
502505

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

0 commit comments

Comments
 (0)