diff options
-rw-r--r-- | drivers/dma/stm32-dma.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index e4cbe38d1b83..5989b0893521 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c | |||
@@ -243,12 +243,6 @@ static void stm32_dma_write(struct stm32_dma_device *dmadev, u32 reg, u32 val) | |||
243 | writel_relaxed(val, dmadev->base + reg); | 243 | writel_relaxed(val, dmadev->base + reg); |
244 | } | 244 | } |
245 | 245 | ||
246 | static struct stm32_dma_desc *stm32_dma_alloc_desc(u32 num_sgs) | ||
247 | { | ||
248 | return kzalloc(sizeof(struct stm32_dma_desc) + | ||
249 | sizeof(struct stm32_dma_sg_req) * num_sgs, GFP_NOWAIT); | ||
250 | } | ||
251 | |||
252 | static int stm32_dma_get_width(struct stm32_dma_chan *chan, | 246 | static int stm32_dma_get_width(struct stm32_dma_chan *chan, |
253 | enum dma_slave_buswidth width) | 247 | enum dma_slave_buswidth width) |
254 | { | 248 | { |
@@ -853,7 +847,7 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_slave_sg( | |||
853 | return NULL; | 847 | return NULL; |
854 | } | 848 | } |
855 | 849 | ||
856 | desc = stm32_dma_alloc_desc(sg_len); | 850 | desc = kzalloc(struct_size(desc, sg_req, sg_len), GFP_NOWAIT); |
857 | if (!desc) | 851 | if (!desc) |
858 | return NULL; | 852 | return NULL; |
859 | 853 | ||
@@ -954,7 +948,7 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_cyclic( | |||
954 | 948 | ||
955 | num_periods = buf_len / period_len; | 949 | num_periods = buf_len / period_len; |
956 | 950 | ||
957 | desc = stm32_dma_alloc_desc(num_periods); | 951 | desc = kzalloc(struct_size(desc, sg_req, num_periods), GFP_NOWAIT); |
958 | if (!desc) | 952 | if (!desc) |
959 | return NULL; | 953 | return NULL; |
960 | 954 | ||
@@ -989,7 +983,7 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_memcpy( | |||
989 | int i; | 983 | int i; |
990 | 984 | ||
991 | num_sgs = DIV_ROUND_UP(len, STM32_DMA_ALIGNED_MAX_DATA_ITEMS); | 985 | num_sgs = DIV_ROUND_UP(len, STM32_DMA_ALIGNED_MAX_DATA_ITEMS); |
992 | desc = stm32_dma_alloc_desc(num_sgs); | 986 | desc = kzalloc(struct_size(desc, sg_req, num_sgs), GFP_NOWAIT); |
993 | if (!desc) | 987 | if (!desc) |
994 | return NULL; | 988 | return NULL; |
995 | 989 | ||