From 0a940b0d252bb8616bb36a254f6a3273f007c3f3 Mon Sep 17 00:00:00 2001 From: Souptick Joarder Date: Fri, 28 Oct 2016 17:30:16 +0530 Subject: [PATCH] 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 Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ifx6x60.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index d386346..1578836 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; } -- 2.7.4