Commit 0b3ea2a0 authored by Hans de Goede's avatar Hans de Goede Committed by Wolfram Sang
Browse files

i2c: i801: Fix the i2c-mux gpiod_lookup_table not being properly terminated



gpiod_add_lookup_table() expects the gpiod_lookup_table->table passed to
it to be terminated with a zero-ed out entry.

So we need to allocate one more entry then we will use.

Fixes: d308dfbf ("i2c: mux/i801: Switch to use descriptor passing")
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: default avatarJean Delvare <jdelvare@suse.de>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 0b884fe7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1449,7 +1449,7 @@ static int i801_add_mux(struct i801_priv *priv)


	/* Register GPIO descriptor lookup table */
	/* Register GPIO descriptor lookup table */
	lookup = devm_kzalloc(dev,
	lookup = devm_kzalloc(dev,
			      struct_size(lookup, table, mux_config->n_gpios),
			      struct_size(lookup, table, mux_config->n_gpios + 1),
			      GFP_KERNEL);
			      GFP_KERNEL);
	if (!lookup)
	if (!lookup)
		return -ENOMEM;
		return -ENOMEM;