diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2017-09-10 05:12:52 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-09-10 12:27:40 -0400 |
commit | 1f4adab8733b29f81d21f74e2194bd8ddb80e574 (patch) | |
tree | e0ad5d58c49deee613718386ec69bf955cafd84d | |
parent | 68e6f221ed08674374dc397fe52a64817599fce7 (diff) | |
download | u-boot-1f4adab8733b29f81d21f74e2194bd8ddb80e574.zip u-boot-1f4adab8733b29f81d21f74e2194bd8ddb80e574.tar.gz u-boot-1f4adab8733b29f81d21f74e2194bd8ddb80e574.tar.bz2 |
block: ide: Don't bother to create BLK device if no CDROM inserted
When there is no CDROM inserted, the block size is zero hence there
is no need to create a BLK device for it.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/block/ide.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/block/ide.c b/drivers/block/ide.c index ed3b27e..9ab01a9 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -1202,6 +1202,13 @@ static int ide_probe(struct udevice *udev) blksz = ide_dev_desc[i].blksz; size = blksz * ide_dev_desc[i].lba; + + /* + * With CDROM, if there is no CD inserted, blksz will + * be zero, don't bother to create IDE block device. + */ + if (!blksz) + continue; ret = blk_create_devicef(udev, "ide_blk", name, IF_TYPE_IDE, i, blksz, size, &blk_dev); |