mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
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>
This commit is contained in:
@ -1202,6 +1202,13 @@ static int ide_probe(struct udevice *udev)
|
|||||||
|
|
||||||
blksz = ide_dev_desc[i].blksz;
|
blksz = ide_dev_desc[i].blksz;
|
||||||
size = blksz * ide_dev_desc[i].lba;
|
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,
|
ret = blk_create_devicef(udev, "ide_blk", name,
|
||||||
IF_TYPE_IDE, i,
|
IF_TYPE_IDE, i,
|
||||||
blksz, size, &blk_dev);
|
blksz, size, &blk_dev);
|
||||||
|
Reference in New Issue
Block a user