serial: ifx6x60: Free memory when probe fails

When spi_setup() fails it doesn't free ifx_dev and we have a memory
leak. Fix this by freeing ifx_dev before the return.

Signed-off-by: Souptick joarder <jrdr.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Souptick Joarder 2016-10-28 17:30:16 +05:30 committed by Greg Kroah-Hartman
parent 7f8b4ebeb2
commit 0a940b0d25
1 changed files with 1 additions and 0 deletions

View File

@ -1042,6 +1042,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
ret = spi_setup(spi);
if (ret) {
dev_err(&spi->dev, "SPI setup wasn't successful %d", ret);
kfree(ifx_dev);
return -ENODEV;
}