nand/elbc: Memory leak fix
authorRaghav Dogra <raghav@freescale.com>
Wed, 20 May 2015 09:24:58 +0000 (14:54 +0530)
committerScott Wood <scottwood@freescale.com>
Fri, 22 May 2015 20:45:51 +0000 (15:45 -0500)
Freeing allocated memory to priv before returning
from the function

Signed-off-by: Raghav Dogra <raghav@freescale.com>
[scottwood: removed unnecessary cast]
Signed-off-by: Scott Wood <scottwood@freescale.com>
drivers/mtd/nand/fsl_elbc_nand.c

index e85832d319d0270231aa5aadef1c424a555832ea..b3a0edbf149e3cce93ed1af462ca011808c1bee8 100644 (file)
@@ -679,6 +679,7 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr)
        if (priv->bank >= MAX_BANKS) {
                printf("fsl_elbc_nand: address did not match any "
                       "chip selects\n");
+               kfree(priv);
                return -ENODEV;
        }