Commit 72eac302 authored by Maxime Ripard's avatar Maxime Ripard Committed by Linus Walleij
parent ab3b8782
...@@ -90,7 +90,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi) ...@@ -90,7 +90,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi)
if (ret < 0) if (ret < 0)
return ret; return ret;
chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL);
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
...@@ -125,7 +125,6 @@ static int __devinit gen_74x164_probe(struct spi_device *spi) ...@@ -125,7 +125,6 @@ static int __devinit gen_74x164_probe(struct spi_device *spi)
exit_destroy: exit_destroy:
dev_set_drvdata(&spi->dev, NULL); dev_set_drvdata(&spi->dev, NULL);
mutex_destroy(&chip->lock); mutex_destroy(&chip->lock);
kfree(chip);
return ret; return ret;
} }
...@@ -141,10 +140,9 @@ static int __devexit gen_74x164_remove(struct spi_device *spi) ...@@ -141,10 +140,9 @@ static int __devexit gen_74x164_remove(struct spi_device *spi)
dev_set_drvdata(&spi->dev, NULL); dev_set_drvdata(&spi->dev, NULL);
ret = gpiochip_remove(&chip->gpio_chip); ret = gpiochip_remove(&chip->gpio_chip);
if (!ret) { if (!ret)
mutex_destroy(&chip->lock); mutex_destroy(&chip->lock);
kfree(chip); else
} else
dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n", dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
ret); ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment