summaryrefslogtreecommitdiff
path: root/middleware
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2017-04-07 18:25:24 -0700
committerStefan Agner <stefan.agner@toradex.com>2017-04-07 18:28:25 -0700
commit6f0eaf1814e57d187acf57b3fed6561e26a8a21e (patch)
treeaf6571e3ac90bbb4b3469d1752c05f34374ff921 /middleware
parentec57ed4d8fbbe4285b9105c8e5cd4670f7ee4e80 (diff)
virtio: Redefine vring_avail_eventColibri-iMX7-M4_FreeRTOS_1.2-20170407
Redefine vring_avail_event to avoid accessing ring.id as a 16bit integer and breaking the C aliasing rules. This fixes a build warning: virtio/virtqueue.c: In function ‘vq_ring_must_notify_host’: virtio/virtqueue.c:658:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] event_idx = vring_avail_event(&vq->vq_ring); ^ No functional change. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Wendy Liang <jliang@xilinx.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Diffstat (limited to 'middleware')
-rw-r--r--middleware/multicore/open-amp/virtio/virtio_ring.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/middleware/multicore/open-amp/virtio/virtio_ring.h b/middleware/multicore/open-amp/virtio/virtio_ring.h
index 3f1cf50..07a2d07 100644
--- a/middleware/multicore/open-amp/virtio/virtio_ring.h
+++ b/middleware/multicore/open-amp/virtio/virtio_ring.h
@@ -121,7 +121,7 @@ struct vring {
* versa. They are at the end for backwards compatibility.
*/
#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
-#define vring_avail_event(vr) (*(uint16_t *)&(vr)->used->ring[(vr)->num])
+#define vring_avail_event(vr) ((vr)->used->ring[(vr)->num].id & 0xFFFF)
static inline int
vring_size(unsigned int num, unsigned long align)