summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mcp23s08.c
diff options
context:
space:
mode:
authorVarka Bhadram <varkabhadram@gmail.com>2015-03-31 09:49:08 +0530
committerLinus Walleij <linus.walleij@linaro.org>2015-04-08 09:54:05 +0200
commit7898b31ebafbf01d2ad56d251cfc9bfa4e5c644a (patch)
tree42e9370e7dc2765dad94947021d79fb106c4e92d /drivers/gpio/gpio-mcp23s08.c
parentd1e10dc8c104d533547f6e499550fafc36809943 (diff)
downloadtalos-op-linux-7898b31ebafbf01d2ad56d251cfc9bfa4e5c644a.tar.gz
talos-op-linux-7898b31ebafbf01d2ad56d251cfc9bfa4e5c644a.zip
gpio: use devm_kzalloc
We can use devres API for allocating memory. No need of using kfree. Signed-off-by: Varka Bhadram <varkab@cdac.in> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mcp23s08.c')
-rw-r--r--drivers/gpio/gpio-mcp23s08.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index eea5d7e578c9..a17b81fea161 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -949,10 +949,12 @@ static int mcp23s08_probe(struct spi_device *spi)
if (!chips)
return -ENODEV;
- data = kzalloc(sizeof(*data) + chips * sizeof(struct mcp23s08),
- GFP_KERNEL);
+ data = devm_kzalloc(&spi->dev,
+ sizeof(*data) + chips * sizeof(struct mcp23s08),
+ GFP_KERNEL);
if (!data)
return -ENOMEM;
+
spi_set_drvdata(spi, data);
spi->irq = irq_of_parse_and_map(spi->dev.of_node, 0);
@@ -989,7 +991,6 @@ fail:
continue;
gpiochip_remove(&data->mcp[addr]->chip);
}
- kfree(data);
return status;
}
OpenPOWER on IntegriCloud