Commit 8145dce8 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Vinod Koul

dmaengine: stm32-mdma: Use struct_size() in kzalloc()

Make use of the new struct_size() helper instead of the offsetof() idiom.
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20201008141828.GA20325@embeddedorSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent d98793b5
...@@ -339,7 +339,7 @@ static struct stm32_mdma_desc *stm32_mdma_alloc_desc( ...@@ -339,7 +339,7 @@ static struct stm32_mdma_desc *stm32_mdma_alloc_desc(
struct stm32_mdma_desc *desc; struct stm32_mdma_desc *desc;
int i; int i;
desc = kzalloc(offsetof(typeof(*desc), node[count]), GFP_NOWAIT); desc = kzalloc(struct_size(desc, node, count), GFP_NOWAIT);
if (!desc) if (!desc)
return NULL; return NULL;
......
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