mirror of
https://github.com/opnsense/src.git
synced 2026-04-22 06:39:32 -04:00
Do not change/get mode on a nonexisting device.
This commit is contained in:
parent
742f5bdd4c
commit
7154fc7c7b
1 changed files with 10 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue