]> git.sur5r.net Git - u-boot/commitdiff
block: ide: Don't bother to create BLK device if no CDROM inserted
authorBin Meng <bmeng.cn@gmail.com>
Sun, 10 Sep 2017 12:12:52 +0000 (05:12 -0700)
committerTom Rini <trini@konsulko.com>
Sun, 10 Sep 2017 16:27:40 +0000 (12:27 -0400)
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>
drivers/block/ide.c

index ed3b27e6e7590a4869edd948f7bd99dedb15229c..9ab01a9861fa9d6600d270f0c9ce6918301df8bb 100644 (file)
@@ -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);