Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 632d8e55 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Walleij
Browse files

gpio: mc33880: use devm_kzalloc()



Use devm_kzalloc() to make cleanup paths simpler.

Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b09638a4
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ static int mc33880_probe(struct spi_device *spi)
	if (ret < 0)
		return ret;

	mc = kzalloc(sizeof(struct mc33880), GFP_KERNEL);
	mc = devm_kzalloc(&spi->dev, sizeof(struct mc33880), GFP_KERNEL);
	if (!mc)
		return -ENOMEM;

@@ -143,7 +143,6 @@ static int mc33880_probe(struct spi_device *spi)
exit_destroy:
	dev_set_drvdata(&spi->dev, NULL);
	mutex_destroy(&mc->lock);
	kfree(mc);
	return ret;
}

@@ -159,10 +158,9 @@ static int mc33880_remove(struct spi_device *spi)
	dev_set_drvdata(&spi->dev, NULL);

	ret = gpiochip_remove(&mc->chip);
	if (!ret) {
	if (!ret)
		mutex_destroy(&mc->lock);
		kfree(mc);
	} else
	else
		dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
			ret);