Skip to content

Commit 926a4b1

Browse files
tititiou36vinodkoul
authored andcommitted
dmaengine: ep93xx: Use struct_size()
Use struct_size() instead of hand-writing it, when allocating a structure with a flex array. This is less verbose, more robust and more informative. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/36fa11d95b448b5f3f1677da41fe35b9e2751427.1690041500.git.christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 897500c commit 926a4b1

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/dma/ep93xx_dma.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,11 +1320,9 @@ static int __init ep93xx_dma_probe(struct platform_device *pdev)
13201320
struct ep93xx_dma_platform_data *pdata = dev_get_platdata(&pdev->dev);
13211321
struct ep93xx_dma_engine *edma;
13221322
struct dma_device *dma_dev;
1323-
size_t edma_size;
13241323
int ret, i;
13251324

1326-
edma_size = pdata->num_channels * sizeof(struct ep93xx_dma_chan);
1327-
edma = kzalloc(sizeof(*edma) + edma_size, GFP_KERNEL);
1325+
edma = kzalloc(struct_size(edma, channels, pdata->num_channels), GFP_KERNEL);
13281326
if (!edma)
13291327
return -ENOMEM;
13301328

0 commit comments

Comments
 (0)