diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/block/virtio-blk.c | 10 | ||||
-rw-r--r-- | hw/core/qdev-properties-system.c | 4 | ||||
-rw-r--r-- | hw/misc/tmp105.c | 2 | ||||
-rw-r--r-- | hw/misc/tmp421.c | 2 | ||||
-rw-r--r-- | hw/tpm/tpm_tis.c | 12 | ||||
-rw-r--r-- | hw/virtio/virtio.c | 8 |
6 files changed, 19 insertions, 19 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 83cf5c01f9..f208c6ddb9 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -96,7 +96,7 @@ static void virtio_blk_rw_complete(void *opaque, int ret) trace_virtio_blk_rw_complete(vdev, req, ret); if (req->qiov.nalloc != -1) { - /* If nalloc is != 1 req->qiov is a local copy of the original + /* If nalloc is != -1 req->qiov is a local copy of the original * external iovec. It was allocated in submit_requests to be * able to merge requests. */ qemu_iovec_destroy(&req->qiov); @@ -482,7 +482,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) { uint32_t type; struct iovec *in_iov = req->elem.in_sg; - struct iovec *iov = req->elem.out_sg; + struct iovec *out_iov = req->elem.out_sg; unsigned in_num = req->elem.in_num; unsigned out_num = req->elem.out_num; VirtIOBlock *s = req->dev; @@ -493,13 +493,13 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) return -1; } - if (unlikely(iov_to_buf(iov, out_num, 0, &req->out, + if (unlikely(iov_to_buf(out_iov, out_num, 0, &req->out, sizeof(req->out)) != sizeof(req->out))) { virtio_error(vdev, "virtio-blk request outhdr too short"); return -1; } - iov_discard_front(&iov, &out_num, sizeof(req->out)); + iov_discard_front(&out_iov, &out_num, sizeof(req->out)); if (in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) { virtio_error(vdev, "virtio-blk request inhdr too short"); @@ -526,7 +526,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) &req->out.sector); if (is_write) { - qemu_iovec_init_external(&req->qiov, iov, out_num); + qemu_iovec_init_external(&req->qiov, out_iov, out_num); trace_virtio_blk_handle_write(vdev, req, req->sector_num, req->qiov.size / BDRV_SECTOR_SIZE); } else { diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 8b22fb51c9..b45a7ef54b 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -288,10 +288,6 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, } for (i = 0; i < queues; i++) { - if (peers[i] == NULL) { - err = -ENOENT; - goto out; - } if (peers[i]->peer) { err = -EEXIST; diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c index 0918f3a6ea..f6d7163273 100644 --- a/hw/misc/tmp105.c +++ b/hw/misc/tmp105.c @@ -79,7 +79,7 @@ static void tmp105_set_temperature(Object *obj, Visitor *v, const char *name, return; } if (temp >= 128000 || temp < -128000) { - error_setg(errp, "value %" PRId64 ".%03" PRIu64 " °C is out of range", + error_setg(errp, "value %" PRId64 ".%03" PRIu64 " C is out of range", temp / 1000, temp % 1000); return; } diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c index c234044305..eeb11000f0 100644 --- a/hw/misc/tmp421.c +++ b/hw/misc/tmp421.c @@ -153,7 +153,7 @@ static void tmp421_set_temperature(Object *obj, Visitor *v, const char *name, } if (temp >= maxs[ext_range] || temp < mins[ext_range]) { - error_setg(errp, "value %" PRId64 ".%03" PRIu64 " °C is out of range", + error_setg(errp, "value %" PRId64 ".%03" PRIu64 " C is out of range", temp / 1000, temp % 1000); return; } diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index d9322692ee..2563d7501f 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -233,7 +233,7 @@ static void tpm_tis_new_active_locality(TPMState *s, uint8_t new_active_locty) } /* abort -- this function switches the locality */ -static void tpm_tis_abort(TPMState *s, uint8_t locty) +static void tpm_tis_abort(TPMState *s) { s->rw_offset = 0; @@ -263,7 +263,9 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t locty, uint8_t newlocty) { uint8_t busy_locty; - s->aborting_locty = locty; + assert(TPM_TIS_IS_VALID_LOCTY(newlocty)); + + s->aborting_locty = locty; /* may also be TPM_TIS_NO_LOCALITY */ s->next_locty = newlocty; /* locality after successful abort */ /* @@ -281,7 +283,7 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t locty, uint8_t newlocty) } } - tpm_tis_abort(s, locty); + tpm_tis_abort(s); } /* @@ -293,6 +295,8 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret) uint8_t locty = s->cmd.locty; uint8_t l; + assert(TPM_TIS_IS_VALID_LOCTY(locty)); + if (s->cmd.selftest_done) { for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) { s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE; @@ -311,7 +315,7 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret) } if (TPM_TIS_IS_VALID_LOCTY(s->next_locty)) { - tpm_tis_abort(s, locty); + tpm_tis_abort(s); } tpm_tis_raise_irq(s, locty, diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5828ed14df..22bd1ac34e 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -796,13 +796,13 @@ static void virtqueue_undo_map_desc(unsigned int out_num, unsigned int in_num, } static void virtqueue_map_iovec(VirtIODevice *vdev, struct iovec *sg, - hwaddr *addr, unsigned int *num_sg, + hwaddr *addr, unsigned int num_sg, int is_write) { unsigned int i; hwaddr len; - for (i = 0; i < *num_sg; i++) { + for (i = 0; i < num_sg; i++) { len = sg[i].iov_len; sg[i].iov_base = dma_memory_map(vdev->dma_as, addr[i], &len, is_write ? @@ -821,8 +821,8 @@ static void virtqueue_map_iovec(VirtIODevice *vdev, struct iovec *sg, void virtqueue_map(VirtIODevice *vdev, VirtQueueElement *elem) { - virtqueue_map_iovec(vdev, elem->in_sg, elem->in_addr, &elem->in_num, 1); - virtqueue_map_iovec(vdev, elem->out_sg, elem->out_addr, &elem->out_num, 0); + virtqueue_map_iovec(vdev, elem->in_sg, elem->in_addr, elem->in_num, 1); + virtqueue_map_iovec(vdev, elem->out_sg, elem->out_addr, elem->out_num, 0); } static void *virtqueue_alloc_element(size_t sz, unsigned out_num, unsigned in_num) |