summaryrefslogtreecommitdiff
path: root/sys/dev/ic/ami.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-05-31 18:39:04 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-05-31 18:39:04 +0000
commit908f8fce16251dd288cd75d715d7323e08e62c76 (patch)
tree539e0295ac546a0a7e80bac68c57a9505de655a8 /sys/dev/ic/ami.c
parent25b0d1ce27ff8aaca36c843ddad3655e08d3382c (diff)
erroneously EINVAL is always reported where the function
actually produces the real errno for the problem. currently for kernel memory allocation failures bioctl would return EINVAL that makes no sense. another diff from mickey
Diffstat (limited to 'sys/dev/ic/ami.c')
-rw-r--r--sys/dev/ic/ami.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index 518707308b9..a4f558d30a0 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.182 2007/05/31 18:34:12 dlg Exp $ */
+/* $OpenBSD: ami.c,v 1.183 2007/05/31 18:39:03 dlg Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -1879,10 +1879,9 @@ ami_ioctl_inq(struct ami_softc *sc, struct bioc_inq *bi)
goto bail;
}
- if (ami_mgmt(sc, AMI_FCOP, AMI_FC_RDCONF, 0, 0, sizeof *p, p)) {
- error = EINVAL;
+ if ((error = ami_mgmt(sc, AMI_FCOP, AMI_FC_RDCONF, 0, 0, sizeof *p,
+ p)))
goto bail2;
- }
memset(plist, 0, AMI_BIG_MAX_PDRIVES);
@@ -2130,10 +2129,8 @@ ami_ioctl_vol(struct ami_softc *sc, struct bioc_vol *bv)
if (!p)
return (ENOMEM);
- if (ami_mgmt(sc, AMI_FCOP, AMI_FC_RDCONF, 0, 0, sizeof *p, p)) {
- error = EINVAL;
+ if ((error = ami_mgmt(sc, AMI_FCOP, AMI_FC_RDCONF, 0, 0, sizeof *p, p)))
goto bail;
- }
if (bv->bv_volid >= p->ada_nld) {
error = ami_vol(sc, bv, p);
@@ -2255,10 +2252,8 @@ ami_ioctl_disk(struct ami_softc *sc, struct bioc_disk *bd)
if (!p)
return (ENOMEM);
- if (ami_mgmt(sc, AMI_FCOP, AMI_FC_RDCONF, 0, 0, sizeof *p, p)) {
- error = EINVAL;
+ if ((error = ami_mgmt(sc, AMI_FCOP, AMI_FC_RDCONF, 0, 0, sizeof *p, p)))
goto bail;
- }
if (bd->bd_volid >= p->ada_nld) {
error = ami_disk(sc, bd, p);
@@ -2381,13 +2376,13 @@ int ami_ioctl_alarm(struct ami_softc *sc, struct bioc_alarm *ba)
return (EINVAL);
}
- if (ami_mgmt(sc, AMI_SPEAKER, func, 0, 0, sizeof ret, &ret))
- error = EINVAL;
- else
+ if (!(error = ami_mgmt(sc, AMI_SPEAKER, func, 0, 0, sizeof ret,
+ &ret))) {
if (ba->ba_opcode == BIOC_GASTATUS)
ba->ba_status = ret;
else
ba->ba_status = 0;
+ }
return (error);
}
@@ -2396,8 +2391,7 @@ int
ami_ioctl_setstate(struct ami_softc *sc, struct bioc_setstate *bs)
{
struct scsi_inquiry_data inqbuf;
- int func;
- int off;
+ int func, off, error;
switch (bs->bs_status) {
case BIOC_SSONLINE:
@@ -2424,9 +2418,9 @@ ami_ioctl_setstate(struct ami_softc *sc, struct bioc_setstate *bs)
return (EINVAL);
}
- if (ami_mgmt(sc, AMI_CHSTATE, bs->bs_channel, bs->bs_target, func,
- 0, NULL))
- return (EINVAL);
+ if ((error = ami_mgmt(sc, AMI_CHSTATE, bs->bs_channel, bs->bs_target,
+ func, 0, NULL)))
+ return (error);
return (0);
}