Gustavo A. R. Silva
ac227fb5bc
regulator: da9063: 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;
struct boo entry[];
};
size = sizeof(struct foo) + count * sizeof(struct boo);
instance = alloc(size, GFP_KERNEL)
Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:
instance = alloc(struct_size(instance, entry, count), GFP_KERNEL)
Notice that, in this case, variable size is not necessary, hence it is
removed.
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com >
Signed-off-by: Mark Brown <broonie@kernel.org >
2019-02-22 15:16:57 +00:00
..
2019-01-03 18:57:57 -08:00
2018-12-19 09:40:13 +01:00
2019-01-02 18:47:56 -08:00
2018-12-21 21:27:21 +01:00
2019-01-05 13:25:58 -08:00
2019-01-03 08:21:47 -07:00
2018-12-19 13:43:42 +01:00
2018-12-31 17:32:35 -08:00
2018-12-29 08:20:44 -07:00
2019-01-03 18:57:57 -08:00
2019-01-02 18:56:59 -08:00
2019-01-05 09:50:07 -08:00
2018-12-27 10:43:24 -08:00
2018-12-27 10:43:24 -08:00
2019-01-03 18:57:57 -08:00
2018-12-28 12:11:47 -08:00
2019-01-04 14:31:38 -08:00
2019-01-04 13:13:46 -08:00
2018-12-19 11:57:45 +01:00
2019-01-05 18:33:21 -08:00
2019-01-05 11:28:39 -08:00
2019-01-03 18:57:57 -08:00
2018-12-28 20:00:21 -08:00
2019-01-05 18:25:19 -08:00
2019-01-05 17:53:40 -08:00
2018-12-28 20:54:57 -08:00
2018-12-29 13:03:29 -08:00
2019-01-03 11:42:10 -08:00
2018-12-19 20:21:06 +01:00
2019-01-05 18:13:35 -08:00
2018-12-28 13:19:59 -08:00
2018-12-28 20:39:58 -08:00
2019-01-05 18:20:51 -08:00
2019-01-02 18:56:59 -08:00
2019-01-01 15:55:29 -08:00
2018-12-29 09:40:40 -08:00
2019-01-02 10:31:39 -08:00
2018-12-25 14:52:50 -08:00
2018-12-22 14:45:35 -07:00
2019-01-03 18:57:57 -08:00
2018-12-21 22:31:26 -06:00
2019-01-03 08:21:02 -07:00
2019-01-03 18:57:57 -08:00
2019-01-05 11:30:37 -08:00
2018-12-28 16:52:18 -08:00
2018-12-18 23:13:12 -05:00
2019-01-05 18:13:35 -08:00
2018-12-28 16:52:18 -08:00
2018-12-29 12:03:17 -08:00
2019-01-03 12:53:47 -08:00
2018-12-28 16:55:46 -08:00
2018-12-19 08:35:36 +01:00
2018-12-28 20:08:34 -08:00
2018-12-29 13:40:29 -08:00
2019-01-05 17:57:34 -08:00
2019-01-05 11:23:17 -08:00
2019-01-04 10:13:27 +00:00
2019-01-01 13:19:16 -08:00
2019-01-06 11:40:06 -08:00
2019-01-03 18:57:57 -08:00
2018-12-28 20:22:45 -08:00
2018-12-29 13:03:29 -08:00
2018-12-28 20:54:57 -08:00
2018-12-24 12:06:56 +01:00
2018-12-22 00:25:54 +09:00
2019-02-22 15:16:57 +00:00
2019-01-01 13:24:31 -08:00
2019-01-02 18:37:01 -08:00
2018-12-26 10:32:18 -08:00
2019-01-03 18:57:57 -08:00
2018-12-31 17:32:35 -08:00
2018-12-25 14:43:54 -08:00
2019-01-03 18:57:57 -08:00
2018-12-28 14:48:06 -08:00
2018-12-31 13:06:30 -08:00
2019-01-05 16:07:28 -08:00
2019-01-05 11:30:37 -08:00
2018-12-28 20:54:57 -08:00
2019-01-05 17:57:34 -08:00
2019-01-01 15:55:29 -08:00
2019-01-03 18:57:57 -08:00
2019-01-05 18:15:37 -08:00
2019-01-02 18:54:45 -08:00
2018-12-22 00:25:54 +09:00
2019-01-01 13:16:45 -08:00
2019-01-03 18:57:57 -08:00
2018-12-29 13:40:29 -08:00