MLK-24373-2 arm64: imx8mp: vpu: g1/g2: fix potential deadlock issue
Replace spin_lock() with spin_lock_irqsave() to avoid potential deadlock Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
This commit is contained in:
parent
742c7adea8
commit
85b5d239b0
|
@ -323,23 +323,26 @@ static int hantro_power_on_disirq(hantrodec_t *hantrodev)
|
|||
static int hantro_new_instance(void)
|
||||
{
|
||||
int idx;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock(&owner_lock);
|
||||
spin_lock_irqsave(&owner_lock, flags);
|
||||
if (instance_mask == ((1UL << MAX_HANTRODEC_INSTANCE) - 1)) {
|
||||
spin_unlock(&owner_lock);
|
||||
spin_unlock_irqrestore(&owner_lock, flags);
|
||||
return -1;
|
||||
}
|
||||
idx = ffz(instance_mask);
|
||||
set_bit(idx, &instance_mask);
|
||||
spin_unlock(&owner_lock);
|
||||
spin_unlock_irqrestore(&owner_lock, flags);
|
||||
return idx;
|
||||
}
|
||||
|
||||
static int hantro_free_instance(int idx)
|
||||
{
|
||||
spin_lock(&owner_lock);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&owner_lock, flags);
|
||||
clear_bit(idx, &instance_mask);
|
||||
spin_unlock(&owner_lock);
|
||||
spin_unlock_irqrestore(&owner_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue