diff options
| author | Hans de Goede <hdegoede@redhat.com> | 2020-12-21 14:42:25 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-17 14:05:36 +0100 |
| commit | 55503711adffb2040c11418cdf564cd1a1924309 (patch) | |
| tree | 03673566eea170146985f9acfb8dbde03e27380c /drivers/i2c | |
| parent | 12e8bcaef61a4a55eea3bfdad88bb5146eb6eafa (diff) | |
| download | linux-55503711adffb2040c11418cdf564cd1a1924309.tar.gz linux-55503711adffb2040c11418cdf564cd1a1924309.tar.bz2 linux-55503711adffb2040c11418cdf564cd1a1924309.zip | |
i2c: i801: Fix the i2c-mux gpiod_lookup_table not being properly terminated
commit 0b3ea2a06de1f52ea30865e227e109a5fd3b6214 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: d308dfbf62ef ("i2c: mux/i801: Switch to use descriptor passing")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/i2c')
| -rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index c40eef4e7a98..2b6a4c1f188f 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1424,7 +1424,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; |
