As suggested by Ezequiel GarcĂa, release the spinlock at the end of the
function only, and use a goto for the control flow.
Just a minor cleanup.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
{
int prio, i;
struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
- struct mmp_pdma_phy *phy;
+ struct mmp_pdma_phy *phy, *found = NULL;
unsigned long flags;
/*
phy = &pdev->phy[i];
if (!phy->vchan) {
phy->vchan = pchan;
- spin_unlock_irqrestore(&pdev->phy_lock, flags);
- return phy;
+ found = phy;
+ goto out_unlock;
}
}
}
+out_unlock:
spin_unlock_irqrestore(&pdev->phy_lock, flags);
- return NULL;
+ return found;
}
static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan)