Commit 1f4adab8733b29f81d21f74e2194bd8ddb80e574

Authored by Bin Meng
Committed by Tom Rini
1 parent 68e6f221ed

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>

Showing 1 changed file with 7 additions and 0 deletions Side-by-side Diff

... ... @@ -1202,6 +1202,13 @@
1202 1202  
1203 1203 blksz = ide_dev_desc[i].blksz;
1204 1204 size = blksz * ide_dev_desc[i].lba;
  1205 +
  1206 + /*
  1207 + * With CDROM, if there is no CD inserted, blksz will
  1208 + * be zero, don't bother to create IDE block device.
  1209 + */
  1210 + if (!blksz)
  1211 + continue;
1205 1212 ret = blk_create_devicef(udev, "ide_blk", name,
1206 1213 IF_TYPE_IDE, i,
1207 1214 blksz, size, &blk_dev);