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>
This commit is contained in:
parent
533f05f0ab
commit
a2fd6f6bc0
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/i2c-mux.h>
|
#include <linux/i2c-mux.h>
|
||||||
|
#include <linux/overflow.h>
|
||||||
#include <linux/platform_data/i2c-mux-gpio.h>
|
#include <linux/platform_data/i2c-mux-gpio.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@ -152,7 +153,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
|
|||||||
return -EPROBE_DEFER;
|
return -EPROBE_DEFER;
|
||||||
|
|
||||||
muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values,
|
muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values,
|
||||||
ngpios * sizeof(*mux->gpios), 0,
|
array_size(ngpios, sizeof(*mux->gpios)), 0,
|
||||||
i2c_mux_gpio_select, NULL);
|
i2c_mux_gpio_select, NULL);
|
||||||
if (!muxc) {
|
if (!muxc) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user