summaryrefslogtreecommitdiffstats
path: root/drivers/soc/qcom
diff options
context:
space:
mode:
authorMaulik Shah <mkshah@codeaurora.org>2019-02-21 13:40:36 +0100
committerAndy Gross <agross@kernel.org>2019-04-10 06:40:09 +0200
commitbbeac60f064158aa92b4c72fb50b12231e62cbcd (patch)
tree5ed37ed7cfa67719f2bc3be1358df965455c1391 /drivers/soc/qcom
parentsoc: qcom: cmd-db: Fix an error code in cmd_db_dev_probe() (diff)
downloadlinux-bbeac60f064158aa92b4c72fb50b12231e62cbcd.tar.xz
linux-bbeac60f064158aa92b4c72fb50b12231e62cbcd.zip
drivers: soc: qcom: rpmh-rsc: Correct check for slot number
The return index value from bitmap_find_next_zero_area can be higher than available slot. So correct the check to return error in such case. Signed-off-by: Maulik Shah <mkshah@codeaurora.org> Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org> Reviewed-by: Lina Iyer <ilina@codeaurora.org> Signed-off-by: Andy Gross <agross@kernel.org>
Diffstat (limited to 'drivers/soc/qcom')
-rw-r--r--drivers/soc/qcom/rpmh-rsc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
index 75bd9a83aef0..e278fc11fe5c 100644
--- a/drivers/soc/qcom/rpmh-rsc.c
+++ b/drivers/soc/qcom/rpmh-rsc.c
@@ -459,7 +459,7 @@ static int find_slots(struct tcs_group *tcs, const struct tcs_request *msg,
do {
slot = bitmap_find_next_zero_area(tcs->slots, MAX_TCS_SLOTS,
i, msg->num_cmds, 0);
- if (slot == tcs->num_tcs * tcs->ncpt)
+ if (slot >= tcs->num_tcs * tcs->ncpt)
return -ENOMEM;
i += tcs->ncpt;
} while (slot + msg->num_cmds - 1 >= i);