Skip to content

Commit

Permalink
i2c: i801: Fix the i2c-mux gpiod_lookup_table not being properly term…
Browse files Browse the repository at this point in the history
…inated

commit 0b3ea2a upstream.

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: d308dfb ("i2c: mux/i801: Switch to use descriptor passing")
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
Acked-by: Jean Delvare <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jwrdegoede authored and frank-w committed Jan 18, 2021
1 parent 570edbe commit b97c673
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-i801.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ static int i801_add_mux(struct i801_priv *priv)

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

0 comments on commit b97c673

Please sign in to comment.