From: Lan Yixun (dlan) <dennis.yxun@gmail.com>
Date: Sat, 20 Jul 2013 00:17:59 +0000 (+0800)
Subject: fs/ext4: fix log2blksz un-initialized error, by cacaulating its value from blksz
X-Git-Tag: v2025.01-rc5-pxa1908~16029
X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/html/index.html?a=commitdiff_plain;h=50ffc3b64aa3c8113f0a9fc31ea96e596d60054a;p=u-boot.git

fs/ext4: fix log2blksz un-initialized error, by cacaulating its value from blksz

The problem here is that uboot can't mount ext4 filesystem with
commit "50ce4c07df1" applied. We use hard-coded "SECTOR_SIZE"(512)
before this commit, now we introduce (block_dev_desc_t *)->log2blksz
to replace this macro. And after we calling do_ls()->fs_set_blk_dev(),
the variable log2blksz is not initialized, which it's not correct.

And this patch try to solve the problem by caculating the value of
log2blksz from variable blksz.
---

diff --git a/disk/part.c b/disk/part.c
index d73625c443..9400a97564 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -548,6 +548,8 @@ int get_device_and_partition(const char *ifname, const char *dev_part_str,
 			goto cleanup;
 		}
 
+		(*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz);
+
 		info->start = 0;
 		info->size = (*dev_desc)->lba;
 		info->blksz = (*dev_desc)->blksz;
@@ -631,6 +633,8 @@ int get_device_and_partition(const char *ifname, const char *dev_part_str,
 		goto cleanup;
 	}
 
+	(*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz);
+
 	ret = part;
 	goto cleanup;