You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/01 05:22:30 UTC

[nuttx] branch master updated: driver/ftl: pass the number of eraseblock for ftl_get_cblock

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 917728bad9 driver/ftl: pass the number of eraseblock for ftl_get_cblock
917728bad9 is described below

commit 917728bad996fb59a84baa15901595fad3270013
Author: dongjiuzhu1 <do...@xiaomi.com>
AuthorDate: Tue Aug 1 10:42:20 2023 +0800

    driver/ftl: pass the number of eraseblock for ftl_get_cblock
    
    Signed-off-by: dongjiuzhu1 <do...@xiaomi.com>
---
 drivers/mtd/ftl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 8f0a3f292c..7cbf48afe5 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -296,7 +296,8 @@ static ssize_t ftl_mtd_bread(FAR struct ftl_struct_s *dev, off_t startblock,
           break;
         }
 
-      count = ftl_get_cblock(dev, starteraseblock, (nblocks + mask) & ~mask);
+      count = ftl_get_cblock(dev, starteraseblock,
+                             (nblocks + mask) / dev->blkper);
       count = MIN(count * dev->blkper, nblocks);
       startphysicalblock = dev->lptable[starteraseblock] *
                            dev->blkper + (startblock & mask);