Skip to contentSkip to conversation

virtio_balloon: fix sparse warning

PATCH Superseded Michael S. Tsirkin 3 participants 3 messages Jul 10, 2020 – Jul 13, 2020

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 virtio_balloon: fix sparse warning

balloon uses virtio32_to_cpu instead of cpu_to_virtio32 to convert a native endian number to virtio. No practical difference but makes sparse warn. Fix it up.

---
 drivers/virtio/virtio_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +1 -1
index fc7301406540..5d4b891bf84f 100644
@@ -596,7 +596,7 @@ static int send_cmd_id_start(struct virtio_balloon *vb)
 	while (virtqueue_get_buf(vq, &unused))
 		;
 
-	vb->cmd_id_active = virtio32_to_cpu(vb->vdev,
+	vb->cmd_id_active = cpu_to_virtio32(vb->vdev,
 					virtio_balloon_cmd_id_received(vb));
 	sg_init_one(&sg, &vb->cmd_id_active, sizeof(vb->cmd_id_active));
 	err = virtqueue_add_outbuf(vq, &sg, 1, &vb->cmd_id_active, GFP_KERNEL);
Signature · 1 line
MST
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Michael S. Tsirkin

balloon uses virtio32_to_cpu instead of cpu_to_virtio32 to convert a native endian number to virtio. No practical difference but makes sparse warn. Fix it up.

---
 drivers/virtio/virtio_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +0 -0
index fc7301406540..5d4b891bf84f 100644

drivers/virtio/virtio_balloon.c static int send_cmd_id_start(struct virtio_balloon *vb) · line 602

Quoted 8 lines
drivers/virtio/virtio_balloon.c +1 -1
@@ -596,7 +596,7 @@ static int send_cmd_id_start(struct virtio_balloon *vb)
 	while (virtqueue_get_buf(vq, &unused))
 		;
 
-	vb->cmd_id_active = virtio32_to_cpu(vb->vdev,
+	vb->cmd_id_active = cpu_to_virtio32(vb->vdev,
 					virtio_balloon_cmd_id_received(vb));
 	sg_init_one(&sg, &vb->cmd_id_active, sizeof(vb->cmd_id_active));
 	err = virtqueue_add_outbuf(vq, &sg, 1, &vb->cmd_id_active, GFP_KERNEL);
Signature · 3 lines
Thanks,

David / dhildenb
Acked-by on v1 1/1
#2 lore raw
In reply to Michael S. Tsirkin
Quoted 15 lines · Michael S. Tsirkin

balloon uses virtio32_to_cpu instead of cpu_to_virtio32 to convert a native endian number to virtio. No practical difference but makes sparse warn. Fix it up.

---
  drivers/virtio/virtio_balloon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +0 -0
index fc7301406540..5d4b891bf84f 100644

drivers/virtio/virtio_balloon.c static int send_cmd_id_start(struct virtio_balloon *vb) · line 602

Quoted 8 lines
drivers/virtio/virtio_balloon.c +1 -1
@@ -596,7 +596,7 @@ static int send_cmd_id_start(struct virtio_balloon *vb)
  	while (virtqueue_get_buf(vq, &unused))
  		;
 
-	vb->cmd_id_active = virtio32_to_cpu(vb->vdev,
+	vb->cmd_id_active = cpu_to_virtio32(vb->vdev,
  					virtio_balloon_cmd_id_received(vb));
  	sg_init_one(&sg, &vb->cmd_id_active, sizeof(vb->cmd_id_active));
  	err = virtqueue_add_outbuf(vq, &sg, 1, &vb->cmd_id_active, GFP_KERNEL);