mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-02 22:06:47 +07:00
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>
This commit is contained in:
parent
d1e10dc8c1
commit
7898b31eba
@ -378,7 +378,7 @@ static int adp5588_gpio_probe(struct i2c_client *client,
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL);
|
||||
if (dev == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -446,7 +446,6 @@ static int adp5588_gpio_probe(struct i2c_client *client,
|
||||
err_irq:
|
||||
adp5588_irq_teardown(dev);
|
||||
err:
|
||||
kfree(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -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 @@ static int mcp23s08_probe(struct spi_device *spi)
|
||||
continue;
|
||||
gpiochip_remove(&data->mcp[addr]->chip);
|
||||
}
|
||||
kfree(data);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user