diff options
author | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2017-05-15 11:24:31 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-05-23 09:48:44 +0200 |
commit | 2f98e78b5a6b0f14073d677a224428e24b3bdccb (patch) | |
tree | 42d2c9cd4771680c693b49923b0138d295d3d5d8 /drivers/pinctrl/pinctrl-mcp23s08.c | |
parent | 2e29e7677275dd6b50d81890ae28f017234ea52c (diff) |
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: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-mcp23s08.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-mcp23s08.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 94d2c19a6989..4d2e1c3c0e87 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -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; } |