mtd/smart: Fix use of uninitialized variable

This commit is contained in:
Jussi Kivilinna 2017-05-31 09:07:25 -06:00 committed by Gregory Nutt
parent 14c233a2f5
commit c7fcdf968d

View File

@ -1368,7 +1368,8 @@ static int smart_add_sector_to_cache(FAR struct smart_struct_s *dev,
index = 1;
if (dev->cache_entries < CONFIG_MTD_SMART_SECTOR_CACHE_SIZE)
{
index = dev->cache_entries++;
oldest = 0;
index = dev->cache_entries++;
}
else
{
@ -1387,7 +1388,7 @@ static int smart_add_sector_to_cache(FAR struct smart_struct_s *dev,
if (dev->sCache[x].birth < oldest)
{
oldest = dev->sCache[x].birth;
index = x;
index = x;
}
}
}