diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2019-03-28 12:30:29 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2019-04-23 19:31:05 +0200 |
commit | 5bec1fb866df8f58b04a46bcbe27481214977e4c (patch) | |
tree | 35331ab338cd76cdc5e98e40f9831d37bc3dd24f /drivers/bluetooth/hci_qca.c | |
parent | 7f09d5a6c33be66a5ca19bf9dd1c2d90c5dfcf0d (diff) | |
download | linux-5bec1fb866df8f58b04a46bcbe27481214977e4c.tar.bz2 |
Bluetooth: Use struct_size() helper
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;
struct boo entry[];
};
size = sizeof(struct foo) + count * sizeof(struct boo);
Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:
size = struct_size(instance, entry, count);
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/hci_qca.c')
0 files changed, 0 insertions, 0 deletions