Skip to content

Commit f165988

Browse files
Jason Kridnerlinusw
authored andcommitted
pinctrl: mcp23s08: spi: Fix regmap allocation for mcp23s18
Fixes issue created by 9b3e420. It wasn't possible for one_regmap_config to be non-NULL at the point it was tested for mcp23s18 devices. Applied the same pattern of allocating one_regmap_config using devm_kmemdump() and then initializing the local regmap structure from that. Signed-off-by: Jason Kridner <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent e3f72b7 commit f165988

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/pinctrl/pinctrl-mcp23s08.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,13 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
832832
break;
833833

834834
case MCP_TYPE_S18:
835+
one_regmap_config =
836+
devm_kmemdup(dev, &mcp23x17_regmap,
837+
sizeof(struct regmap_config), GFP_KERNEL);
838+
if (!one_regmap_config)
839+
return -ENOMEM;
835840
mcp->regmap = devm_regmap_init(dev, &mcp23sxx_spi_regmap, mcp,
836-
&mcp23x17_regmap);
841+
one_regmap_config);
837842
mcp->reg_shift = 1;
838843
mcp->chip.ngpio = 16;
839844
mcp->chip.label = "mcp23s18";

0 commit comments

Comments
 (0)