aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ata/atapi-fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ata/atapi-fd.c')
-rw-r--r--sys/dev/ata/atapi-fd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c
index 12173323e5bcc..5358afba23e90 100644
--- a/sys/dev/ata/atapi-fd.c
+++ b/sys/dev/ata/atapi-fd.c
@@ -211,15 +211,17 @@ static int
afdopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
{
struct afd_softc *fdp = dev->si_drv1;
- struct disklabel *label;
+ struct disklabel *label = &fdp->disk.d_label;
atapi_test_ready(fdp->atp);
+
afd_prevent_allow(fdp, 1);
+
if (afd_sense(fdp))
printf("afd%d: sense media type failed\n", fdp->lun);
fdp->atp->flags &= ~ATAPI_F_MEDIA_CHANGED;
- label = &fdp->disk.d_label;
+
bzero(label, sizeof *label);
label->d_secsize = fdp->cap.sector_size;
label->d_nsectors = fdp->cap.sectors;