From 651099225e925af16ed673af7cbd9b513e82d887 Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Wed, 4 Aug 2021 15:51:43 +0100 Subject: [PATCH] SFDP: Set region count to 1 for no sector map A flash device with no sector map table has uniform sectors, and we treat the whole flash as one region. In this case the function `sfdp_parse_sector_map_table()` sets the single region's size and high boundary accordingly, but it lacks setting of region count to 1, so users of the SFDP parser may not get the correct number of regions. This commit fixes the issue. --- storage/blockdevice/source/SFDP.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/blockdevice/source/SFDP.cpp b/storage/blockdevice/source/SFDP.cpp index 6c3c01b664..3b5ac248f9 100644 --- a/storage/blockdevice/source/SFDP.cpp +++ b/storage/blockdevice/source/SFDP.cpp @@ -243,6 +243,7 @@ int sfdp_parse_sector_map_table(Callback sfdp tr_debug("No Sector Map Table"); // If there's no sector map, we have a single region sized the entire device size + sfdp_info.smptbl.region_cnt = 1; sfdp_info.smptbl.region_size[0] = sfdp_info.bptbl.device_size_bytes; sfdp_info.smptbl.region_high_boundary[0] = sfdp_info.bptbl.device_size_bytes - 1;