drivers: dma: pl330: Zero initialize the ch_handle

Zero initialize the ch_handle in dma_pl330_configure().
The memset in dma_pl330_config_channel()is incorrect,
as the ch_handle is already populated with valid values and
the dma_pl330_config_channel() is overwriting with zeros.

Signed-off-by: Arjun Jyothi <arjun.jyothi@broadcom.com>
This commit is contained in:
Arjun Jyothi 2020-11-25 12:39:19 +05:30 committed by Carles Cufí
parent 3c420566bd
commit 4fe04c84d4

View file

@ -128,7 +128,6 @@ static void dma_pl330_config_channel(struct dma_pl330_ch_config *ch_cfg,
{
struct dma_pl330_ch_internal *ch_handle = &ch_cfg->internal;
memset(ch_handle, 0, sizeof(*ch_handle));
ch_handle->src_addr = src;
ch_handle->dst_addr = dst;
ch_handle->trans_size = size;
@ -474,6 +473,7 @@ static int dma_pl330_configure(const struct device *dev, uint32_t channel,
{
struct dma_pl330_dev_data *const dev_data = DEV_DATA(dev);
struct dma_pl330_ch_config *channel_cfg;
struct dma_pl330_ch_internal *ch_handle;
if (channel >= MAX_DMA_CHANNELS) {
return -EINVAL;
@ -492,6 +492,9 @@ static int dma_pl330_configure(const struct device *dev, uint32_t channel,
return -ENOTSUP;
}
ch_handle = &channel_cfg->internal;
memset(ch_handle, 0, sizeof(*ch_handle));
channel_cfg->direction = cfg->channel_direction;
channel_cfg->dst_addr_adj = cfg->head_block->dest_addr_adj;