mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-18 04:34:36 +00:00
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>
This commit is contained in:
parent
cddfaebdf7
commit
2559d19f76
1 changed files with 3 additions and 2 deletions
|
@ -119,9 +119,10 @@ static int smp_request_block(struct mdp5_smp *smp,
|
||||||
|
|
||||||
spin_lock_irqsave(&smp->state_lock, flags);
|
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);
|
DBG("%d MMBs allocated (%d reserved)", nblks, reserved);
|
||||||
|
}
|
||||||
|
|
||||||
avail = cnt - bitmap_weight(smp->state, cnt);
|
avail = cnt - bitmap_weight(smp->state, cnt);
|
||||||
if (nblks > avail) {
|
if (nblks > avail) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue