]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drivers: soc: qcom: rpmh-rsc: Correct check for slot number
authorMaulik Shah <mkshah@codeaurora.org>
Thu, 21 Feb 2019 12:40:36 +0000 (18:10 +0530)
committerAndy Gross <agross@kernel.org>
Wed, 10 Apr 2019 04:40:09 +0000 (23:40 -0500)
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>
drivers/soc/qcom/rpmh-rsc.c

index 75bd9a83aef00670d474a69c86fde81aa4794e93..e278fc11fe5cfa7606784901cec178c5cd5a79bd 100644 (file)
@@ -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);