projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
897500c
)
dmaengine: ep93xx: Use struct_size()
author
Christophe JAILLET
<christophe.jaillet@wanadoo.fr>
Sat, 22 Jul 2023 15:58:40 +0000
(17:58 +0200)
committer
Vinod Koul
<vkoul@kernel.org>
Tue, 1 Aug 2023 18:32:51 +0000
(
00:02
+0530)
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>
drivers/dma/ep93xx_dma.c
patch
|
blob
|
history
diff --git
a/drivers/dma/ep93xx_dma.c
b/drivers/dma/ep93xx_dma.c
index
5338a94
..
5c4a448
100644
(file)
--- a/
drivers/dma/ep93xx_dma.c
+++ b/
drivers/dma/ep93xx_dma.c
@@
-1320,11
+1320,9
@@
static int __init ep93xx_dma_probe(struct platform_device *pdev)
struct ep93xx_dma_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct ep93xx_dma_engine *edma;
struct dma_device *dma_dev;
- size_t edma_size;
int ret, i;
- edma_size = pdata->num_channels * sizeof(struct ep93xx_dma_chan);
- edma = kzalloc(sizeof(*edma) + edma_size, GFP_KERNEL);
+ edma = kzalloc(struct_size(edma, channels, pdata->num_channels), GFP_KERNEL);
if (!edma)
return -ENOMEM;