diff options
author | Andy Shevchenko <[email protected]> | 2020-10-09 21:08:55 +0300 |
---|---|---|
committer | Linus Walleij <[email protected]> | 2020-11-05 11:30:17 +0100 |
commit | 2b12c13637134897ba320bd8906a8d918ee7069b (patch) | |
tree | 7cdae334b55308c1ee275e35c2cc95ccb8908f6f | |
parent | 8045ec42d14c6f77b5e925d1421150c043dfb75d (diff) |
pinctrl: mcp23s08: Use full chunk of memory for regmap configuration
It appears that simplification of mcp23s08_spi_regmap_init() made
a regression due to wrong size calculation for dev_kmemdup() call.
It misses the fact that config variable is already a pointer, thus
the sizeof() calculation is wrong and only 4 or 8 bytes were copied.
Fix the parameters to devm_kmemdup() to copy a full chunk of memory.
Fixes: 0874758ecb2b ("pinctrl: mcp23s08: Refactor mcp23s08_spi_regmap_init()")
Reported-by: Martin Hundebøll <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Tested-by: Martin Hundebøll <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Tested-by: Jan Kundrát <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
-rw-r--r-- | drivers/pinctrl/pinctrl-mcp23s08_spi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-mcp23s08_spi.c b/drivers/pinctrl/pinctrl-mcp23s08_spi.c index 1f47a661b0a7..7c72cffe1412 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08_spi.c +++ b/drivers/pinctrl/pinctrl-mcp23s08_spi.c @@ -119,7 +119,7 @@ static int mcp23s08_spi_regmap_init(struct mcp23s08 *mcp, struct device *dev, return -EINVAL; } - copy = devm_kmemdup(dev, &config, sizeof(config), GFP_KERNEL); + copy = devm_kmemdup(dev, config, sizeof(*config), GFP_KERNEL); if (!copy) return -ENOMEM; |