mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
soc: rockchip: sdmmc_vendor_storage: fix the issue of inaccurate calculation of free size
When the amount of data written increases, more space is allocated, but when the amount of data written decreases, the allocated space is reclaimed without updating the value of free_size. Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com> Change-Id: Iecf2af482c1e8af35b9fa3227bcbb597d75f770d
This commit is contained in:
@@ -85,6 +85,7 @@ static int emmc_vendor_storage_init(void)
|
||||
EMMC_VENDOR_PART_SIZE * max_index,
|
||||
EMMC_VENDOR_PART_SIZE, 0))
|
||||
goto error_exit;
|
||||
g_vendor->free_size = sizeof(g_vendor->data) - g_vendor->free_offset;
|
||||
} else {
|
||||
memset((void *)g_vendor, 0, sizeof(*g_vendor));
|
||||
g_vendor->version = 1;
|
||||
@@ -160,8 +161,7 @@ static int emmc_vendor_write(u32 id, void *pbuf, u32 size)
|
||||
item->size = size;
|
||||
memcpy(&p_data[item->offset], pbuf, size);
|
||||
g_vendor->free_offset = offset + align_size;
|
||||
g_vendor->free_size -= (align_size -
|
||||
alloc_size);
|
||||
g_vendor->free_size = sizeof(g_vendor->data) - g_vendor->free_offset;
|
||||
} else {
|
||||
memcpy(&p_data[item->offset],
|
||||
pbuf,
|
||||
|
||||
Reference in New Issue
Block a user