env: mtd: fix usability with NAND flashes
authorWeijie Gao <weijie.gao@mediatek.com>
Tue, 6 May 2025 07:15:01 +0000 (15:15 +0800)
committerTom Rini <trini@konsulko.com>
Fri, 23 May 2025 14:00:51 +0000 (08:00 -0600)
commit7c52bca8121fdd967edf24402590b8aacf4fd23a
tree02351d1f62544c4365e37c24025c83fa95fa21cb
parentdf5dcf7b7eb66f74262c5e501f813aac759557f2
env: mtd: fix usability with NAND flashes

1. As this is for MTD-based devices, the Kconfig dependency should be MTD
   instead of only spi-nor flashes
2. Initialize saved_buf to avoid crash on free()
3. Remaining size should be set correctly to write_size

Fixes: 03fb08d4aef (env: Introduce support for MTD)
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Christian Marangi <ansuelsmth@gmail.com>
env/Kconfig
env/mtd.c