aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/fpga-mgr.c
diff options
context:
space:
mode:
authorGustavo A. R. Silva <[email protected]>2019-01-07 17:06:31 +0000
committerVinod Koul <[email protected]>2019-01-20 05:18:23 +0000
commit863326a6eec9c737fdd40bf9bebe135cba27ab97 (patch)
tree552244e4eda4b53611659b6e17778df3aa54bc3a /drivers/fpga/fpga-mgr.c
parentdmaengine: tegra-apb: Use struct_size() in devm_kzalloc() (diff)
downloadkernel-863326a6eec9c737fdd40bf9bebe135cba27ab97.tar.gz
kernel-863326a6eec9c737fdd40bf9bebe135cba27ab97.zip
dmaengine: tegra210-adma: Use struct_size() in devm_kzalloc()
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; void *entry[]; }; instance = devm_kzalloc(dev, sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = devm_kzalloc(dev, struct_size(instance, entry, count), GFP_KERNEL); This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Vinod Koul <[email protected]>
Diffstat (limited to 'drivers/fpga/fpga-mgr.c')
0 files changed, 0 insertions, 0 deletions