summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorSouptick Joarder2016-10-28 14:00:16 +0200
committerGreg Kroah-Hartman2016-11-10 14:50:46 +0100
commit0a940b0d252bb8616bb36a254f6a3273f007c3f3 (patch)
tree10a1e7ab159e99d9a2d259e2c5b52208aeb86064 /drivers/tty
parentserial: ioc4_serial: Free memory when kzalloc fails during probe (diff)
downloadkernel-qcow2-linux-0a940b0d252bb8616bb36a254f6a3273f007c3f3.tar.gz
kernel-qcow2-linux-0a940b0d252bb8616bb36a254f6a3273f007c3f3.tar.xz
kernel-qcow2-linux-0a940b0d252bb8616bb36a254f6a3273f007c3f3.zip
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>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/ifx6x60.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index d386346248de..157883653256 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -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;
}