imx: nandbcb: Fix resource leak in read_fcb
authorYe Li <ye.li@nxp.com>
Mon, 3 Aug 2020 05:43:45 +0000 (22:43 -0700)
committerStefano Babic <sbabic@denx.de>
Sat, 23 Jan 2021 10:30:31 +0000 (11:30 +0100)
commitf637c40dd7ec664cc911a84282ab3d1ee925f6eb
tree11795f12a25e1a37d3e1d0f0d3a35d520baebb02
parentfc11dc112d1defef0091a3ba2b5785b00e502929
imx: nandbcb: Fix resource leak in read_fcb

Fix Coverity Issue 9006657. In read_fcb, leak of memory to system
resource "fcb_raw_page". Adjust the sequence to check the mtd bad
block prior than allocation of "fcb_raw_page", also check the NULL
return of allocation.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/cmd_nandbcb.c