summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2017-06-09 16:45:18 +0200
committerSimon Glass <sjg@chromium.org>2017-09-11 21:43:58 -0600
commit5fe7702eccf1bae5b10f0309cef03e02bfdfa6ef (patch)
tree1c32f209698ac10b795e3a61f0977cf65da1aee7 /test
parentc98ac3487e413c71e5d36322ef3324b21c6f60f9 (diff)
blk: dm: make blk_create_device() take a number of block instead of a size
There is an overflow problem when taking the size instead of the number of blocks in blk_create_device(). This results in a wrong device size: the device apparent size is its real size modulo 4GB. Using the number of blocks instead of the device size fixes the problem and is more coherent with the internals of the block layer. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/blk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/dm/blk.c b/test/dm/blk.c
index 923e8d95f0..30d1e6184d 100644
--- a/test/dm/blk.c
+++ b/test/dm/blk.c
@@ -23,9 +23,9 @@ static int dm_test_blk_base(struct unit_test_state *uts)
/* Create two, one the parent of the other */
ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test",
- IF_TYPE_HOST, 1, 512, 1024, &blk));
+ IF_TYPE_HOST, 1, 512, 2, &blk));
ut_assertok(blk_create_device(blk, "usb_storage_blk", "test",
- IF_TYPE_USB, 3, 512, 1024, &usb_blk));
+ IF_TYPE_USB, 3, 512, 2, &usb_blk));
/* Check we can find them */
ut_asserteq(-ENODEV, blk_get_device(IF_TYPE_HOST, 0, &dev));
@@ -101,7 +101,7 @@ static int dm_test_blk_find(struct unit_test_state *uts)
struct udevice *blk, *dev;
ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test",
- IF_TYPE_HOST, 1, 512, 1024, &blk));
+ IF_TYPE_HOST, 1, 512, 2, &blk));
ut_asserteq(-ENODEV, blk_find_device(IF_TYPE_HOST, 0, &dev));
ut_assertok(blk_find_device(IF_TYPE_HOST, 1, &dev));
ut_asserteq_ptr(blk, dev);