drivers/mtd:fix uninit data in mtd_config_fs
Signed-off-by: XinStellaris <tianxin7@xiaomi.com>
This commit is contained in:
parent
1530e04f20
commit
a4546f35d2
|
@ -991,14 +991,6 @@ static int nvs_startup(FAR struct nvs_fs *fs)
|
|||
fs->ate_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
|
||||
* complaints on some architectures where the sizeof long is different
|
||||
* from the size of a pointer).
|
||||
|
@ -1020,6 +1012,14 @@ static int nvs_startup(FAR struct nvs_fs *fs)
|
|||
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
|
||||
* a closed block, this is where NVS can write.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue