fs/fat: Fix wrong alloc used in fat_zero_cluster()
Fat_zero_cluster() use fs_heap_malloc() for buffer that is used to call fat_hwread(). Fat_hwread() must be called with IO buffer that have proper alingment because it might use DMA. Fix changes fs_heap_malloc() to fat_io_alloc() which uses correct fat_dma_alloc() if CONFIG_FAT_DMAMEMORY is defined. Signed-off-by: Ari Kimari <ari.kimari@tii.ae>
This commit is contained in:
parent
8fea354a0f
commit
0ded247f44
1 changed files with 2 additions and 2 deletions
|
|
@ -509,7 +509,7 @@ static int fat_zero_cluster(FAR struct fat_mountpt_s *fs, int cluster,
|
||||||
off_t end_sec = sector + DIV_ROUND_UP(end, fs->fs_hwsectorsize);
|
off_t end_sec = sector + DIV_ROUND_UP(end, fs->fs_hwsectorsize);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
buf = fs_heap_malloc(fs->fs_hwsectorsize);
|
buf = fat_io_alloc(fs->fs_hwsectorsize);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
@ -548,7 +548,7 @@ static int fat_zero_cluster(FAR struct fat_mountpt_s *fs, int cluster,
|
||||||
ret = OK;
|
ret = OK;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
fs_heap_free(buf);
|
fat_io_free(buf, fs->fs_hwsectorsize);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue