ASoC: rockchip: multi_dais_pcm: drop dma chan if channel map is zero

Change-Id: I00606c0b5f57f6e3d10ab9c41fd51ce8f10e8b35
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
This commit is contained in:
Sugar Zhang 2018-06-11 17:28:18 +08:00 committed by Tao Huang
parent 576b831ae1
commit eac82456bb

View File

@ -491,10 +491,13 @@ int snd_dmaengine_mpcm_register(struct rk_mdais_dev *mdais)
struct device *child;
struct dmaengine_mpcm *pcm;
struct dma_chan *chan;
unsigned int *tx_maps, *rx_maps;
int ret, i, num;
dev = mdais->dev;
num = mdais->num_dais;
tx_maps = mdais->playback_channel_maps;
rx_maps = mdais->capture_channel_maps;
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
if (!pcm)
return -ENOMEM;
@ -502,15 +505,19 @@ int snd_dmaengine_mpcm_register(struct rk_mdais_dev *mdais)
pcm->mdais = mdais;
for (i = 0; i < num; i++) {
child = mdais->dais[i].dev;
chan = dma_request_slave_channel_reason(child, "tx");
if (IS_ERR(chan))
chan = NULL;
pcm->tx_chans[i] = chan;
if (tx_maps[i]) {
chan = dma_request_slave_channel_reason(child, "tx");
if (IS_ERR(chan))
chan = NULL;
pcm->tx_chans[i] = chan;
}
chan = dma_request_slave_channel_reason(child, "rx");
if (IS_ERR(chan))
chan = NULL;
pcm->rx_chans[i] = chan;
if (rx_maps[i]) {
chan = dma_request_slave_channel_reason(child, "rx");
if (IS_ERR(chan))
chan = NULL;
pcm->rx_chans[i] = chan;
}
}
ret = snd_soc_add_platform(dev, &pcm->platform,