diff options
author | Georgi Djakov <georgi.djakov@linaro.org> | 2020-01-06 19:27:46 +0200 |
---|---|---|
committer | Georgi Djakov <georgi.djakov@linaro.org> | 2020-01-07 09:30:09 +0200 |
commit | 7d7899c5297be8cd6095bcddecbbedccb34dd161 (patch) | |
tree | 3e802918d2850dc988738c9f17a285c403068c12 /drivers/interconnect | |
parent | 2c5127a7fa0369801e623e8c6e58193f86d31d73 (diff) | |
download | linux-7d7899c5297be8cd6095bcddecbbedccb34dd161.tar.gz linux-7d7899c5297be8cd6095bcddecbbedccb34dd161.tar.bz2 linux-7d7899c5297be8cd6095bcddecbbedccb34dd161.zip |
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 <evgreen@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Diffstat (limited to 'drivers/interconnect')
-rw-r--r-- | drivers/interconnect/core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 10dde5df9251..f277e467156f 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -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; |