From: Bin Meng Date: Sun, 10 Sep 2017 12:12:52 +0000 (-0700) Subject: block: ide: Don't bother to create BLK device if no CDROM inserted X-Git-Tag: v2017.09~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1f4adab8733b29f81d21f74e2194bd8ddb80e574;p=u-boot 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 Reviewed-by: Simon Glass --- diff --git a/drivers/block/ide.c b/drivers/block/ide.c index ed3b27e6e7..9ab01a9861 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);