Fix for fwmem write part.

- fix typo
- don't need to check receive buffer.
- don't forget to free xfer on errer.
This commit is contained in:
simokawa 2003-02-05 17:19:34 +00:00
parent a56314b4dc
commit a2b80d2be8

View File

@ -229,7 +229,7 @@ fwmem_write_block(
return NULL; return NULL;
fp = (struct fw_pkt *)xfer->send.buf; fp = (struct fw_pkt *)xfer->send.buf;
fp->mode.wreqb.tcode = FWTCODE_RREQB; fp->mode.wreqb.tcode = FWTCODE_WREQB;
fp->mode.wreqb.dst = htons(xfer->dst); fp->mode.wreqb.dst = htons(xfer->dst);
fp->mode.wreqb.dest_hi = htons(dst_hi); fp->mode.wreqb.dest_hi = htons(dst_hi);
fp->mode.wreqb.dest_lo = htonl(dst_lo); fp->mode.wreqb.dest_lo = htonl(dst_lo);
@ -297,9 +297,10 @@ fwmem_read (dev_t dev, struct uio *uio, int ioflag)
err = tsleep((caddr_t)xfer, FWPRI, "fwmrq", hz); err = tsleep((caddr_t)xfer, FWPRI, "fwmrq", hz);
if (err !=0 || xfer->resp != 0 if (err !=0 || xfer->resp != 0
|| xfer->recv.buf == NULL) || xfer->recv.buf == NULL)
return EINVAL; /* XXX */ err = EIO;
err = uiomove(xfer->recv.buf + xfer->recv.off + 4*3, else
4, uio); err = uiomove(xfer->recv.buf
+ xfer->recv.off + 4*3, 4, uio);
} else { } else {
if (len > MAXLEN) if (len > MAXLEN)
len = MAXLEN; len = MAXLEN;
@ -310,9 +311,10 @@ fwmem_read (dev_t dev, struct uio *uio, int ioflag)
err = tsleep((caddr_t)xfer, FWPRI, "fwmrb", hz); err = tsleep((caddr_t)xfer, FWPRI, "fwmrb", hz);
if (err != 0 || xfer->resp != 0 if (err != 0 || xfer->resp != 0
|| xfer->recv.buf == NULL) || xfer->recv.buf == NULL)
return EINVAL; /* XXX */ err = EIO;
err = uiomove(xfer->recv.buf + xfer->recv.off + 4*4, else
len, uio); err = uiomove(xfer->recv.buf
+ xfer->recv.off + 4*4, len, uio);
} }
fw_xfer_free(xfer); fw_xfer_free(xfer);
if (err) if (err)
@ -358,9 +360,8 @@ fwmem_write (dev_t dev, struct uio *uio, int ioflag)
if (xfer == NULL) if (xfer == NULL)
return EINVAL; return EINVAL;
err = tsleep((caddr_t)xfer, FWPRI, "fwmwq", hz); err = tsleep((caddr_t)xfer, FWPRI, "fwmwq", hz);
if (err !=0 || xfer->resp != 0 if (err !=0 || xfer->resp != 0)
|| xfer->recv.buf == NULL) err = EIO;
return EINVAL; /* XXX */
} else { } else {
if (len > MAXLEN) if (len > MAXLEN)
len = MAXLEN; len = MAXLEN;
@ -372,11 +373,10 @@ fwmem_write (dev_t dev, struct uio *uio, int ioflag)
if (xfer == NULL) if (xfer == NULL)
return EINVAL; return EINVAL;
err = tsleep((caddr_t)xfer, FWPRI, "fwmwb", hz); err = tsleep((caddr_t)xfer, FWPRI, "fwmwb", hz);
if (err != 0 || xfer->resp != 0 if (err != 0 || xfer->resp != 0)
|| xfer->recv.buf == NULL) err = EIO;
return EINVAL; /* XXX */
fw_xfer_free(xfer);
} }
fw_xfer_free(xfer);
} }
return err; return err;
} }