diff options
author | Stephane Viau <sviau@codeaurora.org> | 2015-01-16 13:22:14 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2015-02-01 15:32:47 -0500 |
commit | 2559d19f7650f08122747e7df2bf30e77c62674c (patch) | |
tree | a859f646b906858876b20a35b2be9cc2d9b98bf9 /drivers/gpu/drm/msm | |
parent | cddfaebdf7246994dcaca2fcee817d1030ae4b95 (diff) |
drm/msm/mdp5: Fix negative SMP block allocation
In case we request a number of SMP blocks which is lower than
the already reserved blocks, we should not try to allocate a
negative number, but 0 blocks instead.
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm')
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c index bf551885e019..1f795af89680 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c @@ -119,9 +119,10 @@ static int smp_request_block(struct mdp5_smp *smp, spin_lock_irqsave(&smp->state_lock, flags); - nblks -= reserved; - if (reserved) + if (reserved) { + nblks = max(0, nblks - reserved); DBG("%d MMBs allocated (%d reserved)", nblks, reserved); + } avail = cnt - bitmap_weight(smp->state, cnt); if (nblks > avail) { |