提交 638a542c 编写于 作者: D Daniel Mack 提交者: Vinod Koul

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: NDaniel Mack <zonque@gmail.com>
Acked-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NVinod Koul <vinod.koul@intel.com>
上级 8b298ded
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册