summaryrefslogtreecommitdiff
path: root/drivers/dma/mmp_pdma.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-08-10 20:52:16 +0400
committerVinod Koul <vinod.koul@intel.com>2013-08-14 12:25:15 +0400
commit638a542cc450e5dca52c82437d746548c0bcbd8b (patch)
treec77d879345998f76165543e5bd8f7546127e1e9d /drivers/dma/mmp_pdma.c
parent8b298ded902a96cf434738d2a1d83f4a768362ea (diff)
downloadlinux-638a542cc450e5dca52c82437d746548c0bcbd8b.tar.xz
dma: mmp_pdma: refactor unlocking path in lookup_phy()
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>
Diffstat (limited to 'drivers/dma/mmp_pdma.c')
-rw-r--r--drivers/dma/mmp_pdma.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index b061e2696728..3c2ad72a1621 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -220,7 +220,7 @@ static struct mmp_pdma_phy *lookup_phy(struct mmp_pdma_chan *pchan)
{
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;
/*
@@ -239,14 +239,15 @@ static struct mmp_pdma_phy *lookup_phy(struct mmp_pdma_chan *pchan)
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)