mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
drivers/mtd:fix uninit data in mtd_config_fs
Signed-off-by: XinStellaris <tianxin7@xiaomi.com>
This commit is contained in:
@@ -991,14 +991,6 @@ static int nvs_startup(FAR struct nvs_fs *fs)
|
|||||||
fs->ate_wra = 0;
|
fs->ate_wra = 0;
|
||||||
fs->data_wra = 0;
|
fs->data_wra = 0;
|
||||||
|
|
||||||
/* Check the number of blocks, it should be at least 2. */
|
|
||||||
|
|
||||||
if (fs->geo.neraseblocks < 2)
|
|
||||||
{
|
|
||||||
ferr("Configuration error - block count\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the device geometry. (Casting to uintptr_t first eliminates
|
/* Get the device geometry. (Casting to uintptr_t first eliminates
|
||||||
* complaints on some architectures where the sizeof long is different
|
* complaints on some architectures where the sizeof long is different
|
||||||
* from the size of a pointer).
|
* from the size of a pointer).
|
||||||
@@ -1020,6 +1012,14 @@ static int nvs_startup(FAR struct nvs_fs *fs)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check the number of blocks, it should be at least 2. */
|
||||||
|
|
||||||
|
if (fs->geo.neraseblocks < 2)
|
||||||
|
{
|
||||||
|
ferr("Configuration error - block count\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Step through the blocks to find a open block following
|
/* Step through the blocks to find a open block following
|
||||||
* a closed block, this is where NVS can write.
|
* a closed block, this is where NVS can write.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user