Skip to content

Commit

Permalink
virtio_config: fix up warnings on parisc
Browse files Browse the repository at this point in the history
Apparently, on parisc le16_to_cpu returns an int. virtio_cread_le
is very strict about type sizes so it causes a warning.
Fix it up by casting to the correct type.

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
mstsirkin committed Aug 5, 2020
1 parent 1a86b37 commit c84f91e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions include/linux/virtio_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,10 @@ static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val)
*/
#define virtio_le_to_cpu(x) \
_Generic((x), \
__u8: (x), \
__le16: le16_to_cpu(x), \
__le32: le32_to_cpu(x), \
__le64: le64_to_cpu(x) \
__u8: (u8)(x), \
__le16: (u16)le16_to_cpu(x), \
__le32: (u32)le32_to_cpu(x), \
__le64: (u64)le64_to_cpu(x) \
)

#define virtio_cpu_to_le(x, m) \
Expand Down Expand Up @@ -400,7 +400,6 @@ static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val)
*(ptr) = virtio_le_to_cpu(virtio_cread_v); \
} while(0)

/* Config space accessors. */
#define virtio_cwrite_le(vdev, structname, member, ptr) \
do { \
typeof(((structname*)0)->member) virtio_cwrite_v = \
Expand Down

0 comments on commit c84f91e

Please sign in to comment.