driver/mtd_config_fs: just query when data is null or len is zero

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
This commit is contained in:
xucheng5 2023-07-12 15:08:51 +08:00 committed by Xiang Xiao
parent 4cba6630fb
commit da9b05cc33

View file

@ -1412,7 +1412,7 @@ static ssize_t nvs_read_entry(FAR struct nvs_fs *fs, FAR const uint8_t *key,
}
while (true);
if (data)
if (data && len)
{
rd_addr &= ADDR_BLOCK_MASK;
rd_addr += wlk_ate.offset + wlk_ate.key_len;
@ -1750,7 +1750,7 @@ static ssize_t nvs_read(FAR struct nvs_fs *fs,
uint8_t key[sizeof(pdata->id) + sizeof(pdata->instance)];
#endif
if (pdata == NULL || pdata->len == 0 || pdata->configdata == NULL)
if (pdata == NULL)
{
return -EINVAL;
}