]> git.ipfire.org Git - thirdparty/u-boot.git/commit
mtd: rawnand: cortina_nand: Fix -ENOMEM detection
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Fri, 1 Aug 2025 09:54:04 +0000 (10:54 +0100)
committerMichael Trimarchi <michael@amarulasolutions.com>
Sun, 3 Aug 2025 08:22:04 +0000 (10:22 +0200)
commitebf8aaf7afdeb306b0fb85be2226a00aef18162f
treec5c8f4fbdf9aeb36e8e12a50caa2cfd81ba8ba91
parent56372f834c717402882112ba888943421020b6d5
mtd: rawnand: cortina_nand: Fix -ENOMEM detection

In init_nand_dma there was code to detect failure to allocate memory but
it had two problems. Firstly the 2nd clause when info->tx_desc was NULL
attempted to free info->tx_desc when it should be freeing info->rx_desc.
Secondly there was no detection of both allocations failing, arguably
the more likely scenario. Refactor the code to simplify it and just fail
as soon as either allocation fails.

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/cortina_nand.c