Commit 5df4eb45 authored by M'boumba Cedric Madianga's avatar M'boumba Cedric Madianga Committed by Vinod Koul

dmaengine: stm32-dma: Add error messages if xlate fails

This patch adds some error messages when a slave device fails to request a
channel.
Signed-off-by: default avatarM'boumba Cedric Madianga <cedric.madianga@gmail.com>
Reviewed-by: default avatarLudovic BARRE <ludovic.barre@st.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 276b0046
...@@ -987,29 +987,35 @@ static struct dma_chan *stm32_dma_of_xlate(struct of_phandle_args *dma_spec, ...@@ -987,29 +987,35 @@ static struct dma_chan *stm32_dma_of_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma) struct of_dma *ofdma)
{ {
struct stm32_dma_device *dmadev = ofdma->of_dma_data; struct stm32_dma_device *dmadev = ofdma->of_dma_data;
struct device *dev = dmadev->ddev.dev;
struct stm32_dma_cfg cfg; struct stm32_dma_cfg cfg;
struct stm32_dma_chan *chan; struct stm32_dma_chan *chan;
struct dma_chan *c; struct dma_chan *c;
if (dma_spec->args_count < 3) if (dma_spec->args_count < 4) {
dev_err(dev, "Bad number of cells\n");
return NULL; return NULL;
}
cfg.channel_id = dma_spec->args[0]; cfg.channel_id = dma_spec->args[0];
cfg.request_line = dma_spec->args[1]; cfg.request_line = dma_spec->args[1];
cfg.stream_config = dma_spec->args[2]; cfg.stream_config = dma_spec->args[2];
cfg.threshold = 0; cfg.threshold = dma_spec->args[3];
if ((cfg.channel_id >= STM32_DMA_MAX_CHANNELS) || (cfg.request_line >= if ((cfg.channel_id >= STM32_DMA_MAX_CHANNELS) ||
STM32_DMA_MAX_REQUEST_ID)) (cfg.request_line >= STM32_DMA_MAX_REQUEST_ID)) {
dev_err(dev, "Bad channel and/or request id\n");
return NULL; return NULL;
}
if (dma_spec->args_count > 3)
cfg.threshold = dma_spec->args[3];
chan = &dmadev->chan[cfg.channel_id]; chan = &dmadev->chan[cfg.channel_id];
c = dma_get_slave_channel(&chan->vchan.chan); c = dma_get_slave_channel(&chan->vchan.chan);
if (c) if (!c) {
dev_err(dev, "No more channel avalaible\n");
return NULL;
}
stm32_dma_set_config(chan, &cfg); stm32_dma_set_config(chan, &cfg);
return c; return c;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment