Fix panic at boot with SD/MMC readers with no media present, introduced

at r234177.  Note that this is a temporary fix, until I come up with something
prettier.
This commit is contained in:
Edward Tomasz Napierala 2012-04-17 10:44:28 +00:00
parent a4bd5210d5
commit 48ef856766
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234374

View File

@ -938,7 +938,9 @@ daopen(struct disk *dp)
if (error != 0)
xpt_print(periph->path, "unable to retrieve capacity data");
if (periph->flags & CAM_PERIPH_INVALID)
if (periph->flags & CAM_PERIPH_INVALID ||
softc->disk->d_sectorsize == 0 ||
softc->disk->d_mediasize == 0)
error = ENXIO;
if (error == 0 && (softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 &&