提交 2f98e78b 编写于 作者: S Sebastian Reichel 提交者: Linus Walleij

pinctrl: mcp23s08: use managed kzalloc for mcp

Let's remove a few lines of code by using managed memory for mcp
variable.
Signed-off-by: NSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 2e29e767
......@@ -1019,7 +1019,7 @@ static int mcp230xx_probe(struct i2c_client *client,
}
}
mcp = kzalloc(sizeof(*mcp), GFP_KERNEL);
mcp = devm_kzalloc(&client->dev, sizeof(*mcp), GFP_KERNEL);
if (!mcp)
return -ENOMEM;
......@@ -1027,16 +1027,11 @@ static int mcp230xx_probe(struct i2c_client *client,
status = mcp23s08_probe_one(mcp, &client->dev, client, client->addr,
id->driver_data, pdata, 0);
if (status)
goto fail;
return status;
i2c_set_clientdata(client, mcp);
return 0;
fail:
kfree(mcp);
return status;
}
static int mcp230xx_remove(struct i2c_client *client)
......@@ -1044,7 +1039,6 @@ static int mcp230xx_remove(struct i2c_client *client)
struct mcp23s08 *mcp = i2c_get_clientdata(client);
gpiochip_remove(&mcp->chip);
kfree(mcp);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册