diff options
author | Simon Glass <sjg@chromium.org> | 2016-05-01 13:52:22 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-05-17 09:54:43 -0600 |
commit | 72a85c0d2dfe965c831670f06d3803aaad7bb5b1 (patch) | |
tree | 1479b6bd5647ad2e5fa7f76a180ea8afb78d9122 /drivers/block | |
parent | cd995a8aa0127128132bb50f485c53bfb9593312 (diff) | |
download | u-boot-72a85c0d2dfe965c831670f06d3803aaad7bb5b1.tar.gz |
dm: blk: Fix allocation of block-device numbering
Due to code ordering the block devices are not numbered sequentially. Fix
this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/blk-uclass.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 6ecbff0e93..f67f9b9d55 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -439,15 +439,6 @@ int blk_create_device(struct udevice *parent, const char *drv_name, struct udevice *dev; int ret; - ret = device_bind_driver(parent, drv_name, name, &dev); - if (ret) - return ret; - desc = dev_get_uclass_platdata(dev); - desc->if_type = if_type; - desc->blksz = blksz; - desc->lba = size / blksz; - desc->part_type = PART_TYPE_UNKNOWN; - desc->bdev = dev; if (devnum == -1) { ret = blk_find_max_devnum(if_type); if (ret == -ENODEV) @@ -457,6 +448,15 @@ int blk_create_device(struct udevice *parent, const char *drv_name, else devnum = ret + 1; } + ret = device_bind_driver(parent, drv_name, name, &dev); + if (ret) + return ret; + desc = dev_get_uclass_platdata(dev); + desc->if_type = if_type; + desc->blksz = blksz; + desc->lba = size / blksz; + desc->part_type = PART_TYPE_UNKNOWN; + desc->bdev = dev; desc->devnum = devnum; *devp = dev; |