virtio: Fix wrong type cast from pointer to long

Compiler warning (w32, w64):

include/hw/virtio/virtio_ring.h:142:26: warning:
 cast from pointer to integer of different size [-Wpointer-to-int-cast]

When sizeof(long) < sizeof(void *), this is not only a warning but a
real program error.

Add also missing blanks in the same statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1411536002-14088-1-git-send-email-sw@weilnetz.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Stefan Weil 2014-09-24 07:20:02 +02:00 committed by Peter Maydell
parent ca976d1803
commit c0f896810b

View File

@ -139,8 +139,8 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
vr->num = num; vr->num = num;
vr->desc = p; vr->desc = p;
vr->avail = p + num*sizeof(struct vring_desc); vr->avail = p + num*sizeof(struct vring_desc);
vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(uint16_t) vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(uint16_t)
+ align-1) & ~(align - 1)); + align - 1) & ~(align - 1));
} }
static inline unsigned vring_size(unsigned int num, unsigned long align) static inline unsigned vring_size(unsigned int num, unsigned long align)