platform/x86: i2c-multi-instantiate: Use struct_size() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 25 Jul 2019 19:05:50 +0000 (22:05 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 30 Jul 2019 11:12:51 +0000 (14:12 +0300)
commitc03f282e506f1e873ef9b270cf245509d68dd53b
tree3f74436f9ee685e12c4df0291a9c7e9447c5096e
parentaaed5c9c2a146640170e0fbc84ca97e352c065ce
platform/x86: i2c-multi-instantiate: 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.

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/i2c-multi-instantiate.c