Skip to content

Commit a2fd6f6

Browse files
andy-shevwsakernel
authored andcommitted
i2c: mux: gpio: Use array_size() helper
Use array_size() helper to aid in 2-factor allocation instances. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Evan Green <evgreen@chromium.org> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 533f05f commit a2fd6f6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/i2c/muxes/i2c-mux-gpio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/i2c.h>
99
#include <linux/i2c-mux.h>
10+
#include <linux/overflow.h>
1011
#include <linux/platform_data/i2c-mux-gpio.h>
1112
#include <linux/platform_device.h>
1213
#include <linux/module.h>
@@ -152,7 +153,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
152153
return -EPROBE_DEFER;
153154

154155
muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values,
155-
ngpios * sizeof(*mux->gpios), 0,
156+
array_size(ngpios, sizeof(*mux->gpios)), 0,
156157
i2c_mux_gpio_select, NULL);
157158
if (!muxc) {
158159
ret = -ENOMEM;

0 commit comments

Comments
 (0)