diff options
author | sos <sos@FreeBSD.org> | 2001-03-21 11:44:58 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2001-03-21 11:44:58 +0000 |
commit | 04511cf081c2cb002fdfdd28215bc99ede63610a (patch) | |
tree | 5ca554c6290109851cce28da4fcd488c1204cc6b /sys | |
parent | c2deb094a860c4b2c18a7f820b2e357d6e2e93f8 (diff) | |
download | FreeBSD-src-04511cf081c2cb002fdfdd28215bc99ede63610a.zip FreeBSD-src-04511cf081c2cb002fdfdd28215bc99ede63610a.tar.gz |
Do not change/get mode on a nonexisting device.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ata/ata-all.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 3360531..a6fb7b7 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -343,8 +343,10 @@ ataioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) scp = device_get_softc(device); if (!scp) return ENXIO; - mode->mode[MASTER] = scp->mode[MASTER]; - mode->mode[SLAVE] = scp->mode[SLAVE]; + if (scp->dev_param[MASTER]) + mode->mode[MASTER] = scp->mode[MASTER]; + if (scp->dev_param[SLAVE]) + mode->mode[SLAVE] = scp->mode[SLAVE]; break; } @@ -358,12 +360,14 @@ ataioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) scp = device_get_softc(device); if (!scp) return ENXIO; - if (mode->mode[MASTER] >= 0) + if (scp->dev_param[MASTER] && mode->mode[MASTER] >= 0) { ata_change_mode(scp, ATA_MASTER, mode->mode[MASTER]); - if (mode->mode[SLAVE] >= 0) + mode->mode[MASTER] = scp->mode[MASTER]; + } + if (scp->dev_param[SLAVE] && mode->mode[SLAVE] >= 0) { ata_change_mode(scp, ATA_SLAVE, mode->mode[SLAVE]); - mode->mode[MASTER] = scp->mode[MASTER]; - mode->mode[SLAVE] = scp->mode[SLAVE]; + mode->mode[SLAVE] = scp->mode[SLAVE]; + } break; } |