staging: wimax: i2400m: fix some incorrect type warnings
authorAyush <ayush@disroot.org>
Fri, 12 Feb 2021 21:36:28 +0000 (03:06 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Feb 2021 21:37:50 +0000 (22:37 +0100)
Fix some "incorrect type in assignment" warnings reported
by sparse in tx.c

sparse warnings:
wimax/i2400m/tx.c:788:35: warning: cast to restricted __le16
wimax/i2400m/tx.c:788:33: warning: incorrect type in assignment
(different base types)
wimax/i2400m/tx.c:788:33:    expected restricted __le16 [usertype] num_pls
wimax/i2400m/tx.c:788:33:    got unsigned short [usertype]
wimax/i2400m/tx.c:896:32: warning: cast to restricted __le32
wimax/i2400m/tx.c:896:30: warning: incorrect type in assignment
(different base types)
wimax/i2400m/tx.c:896:30:    expected restricted __le32 [usertype] barker
wimax/i2400m/tx.c:896:30:    got unsigned int [usertype]
wimax/i2400m/tx.c:897:34: warning: cast to restricted __le32
wimax/i2400m/tx.c:897:32: warning: incorrect type in assignment
(different base types)
wimax/i2400m/tx.c:897:32:    expected restricted __le32 [usertype] sequence
wimax/i2400m/tx.c:897:32:    got unsigned int [usertype]
wimax/i2400m/tx.c:899:15: warning: cast to restricted __le32
wimax/i2400m/tx.c:899:15: warning: cast from restricted __le16

Signed-off-by: Ayush <ayush@disroot.org>
Link: https://lore.kernel.org/r/20210212213628.801642-1-ayush@disroot.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wimax/i2400m/tx.c

index e943621..8c01f42 100644 (file)
@@ -785,7 +785,7 @@ try_new:
                d_printf(3, dev, "pld 0x%08x (type 0x%1x len 0x%04zx\n",
                         le32_to_cpu(tx_msg->pld[num_pls].val),
                         pl_type, buf_len);
-               tx_msg->num_pls = le16_to_cpu(num_pls+1);
+               tx_msg->num_pls = cpu_to_le16(num_pls + 1);
                tx_msg->size += padded_len;
                d_printf(2, dev, "TX: appended %zu b (up to %u b) pl #%u\n",
                        padded_len, tx_msg->size, num_pls+1);
@@ -893,10 +893,10 @@ skip:
                 current->pid, (void *) tx_msg - i2400m->tx_buf,
                 (size_t) tx_msg->offset, (size_t) tx_msg->size,
                 (size_t) tx_msg_moved->size);
-       tx_msg_moved->barker = le32_to_cpu(I2400M_H2D_PREVIEW_BARKER);
-       tx_msg_moved->sequence = le32_to_cpu(i2400m->tx_sequence++);
+       tx_msg_moved->barker = cpu_to_le32(I2400M_H2D_PREVIEW_BARKER);
+       tx_msg_moved->sequence = cpu_to_le32(i2400m->tx_sequence++);
 
-       pls = le32_to_cpu(tx_msg_moved->num_pls);
+       pls = le16_to_cpu(tx_msg_moved->num_pls);
        i2400m->tx_pl_num += pls;               /* Update stats */
        if (pls > i2400m->tx_pl_max)
                i2400m->tx_pl_max = pls;