]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: nand: pxa3xx: Free memory on error
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Fri, 1 Aug 2025 10:39:13 +0000 (11:39 +0100)
committerMichael Trimarchi <michael@amarulasolutions.com>
Sun, 3 Aug 2025 08:20:16 +0000 (10:20 +0200)
In pxa3xx_nand_probe_dt if the function detects an error after
allocating memory that memory is not freed before exit. Add the
appropriate free.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: MIchael Trimarchi <michael@amarulasolutions.com>
drivers/mtd/nand/raw/pxa3xx_nand.c

index b78b4e6023803fa6824050d5777fd4b7b61ef76c..7bf54fa46540b95df9c53843046d9fbc7bb8b2b2 100644 (file)
@@ -1765,6 +1765,7 @@ static int pxa3xx_nand_probe_dt(struct udevice *dev, struct pxa3xx_nand_info *in
        pdata->num_cs = dev_read_u32_default(dev, "num-cs", 1);
        if (pdata->num_cs != 1) {
                pr_err("pxa3xx driver supports single CS only\n");
+               kfree(pdata);
                return -EINVAL;
        }