From 04511cf081c2cb002fdfdd28215bc99ede63610a Mon Sep 17 00:00:00 2001 From: sos Date: Wed, 21 Mar 2001 11:44:58 +0000 Subject: Do not change/get mode on a nonexisting device. --- sys/dev/ata/ata-all.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'sys/dev') 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; } -- cgit v1.1