driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: wimax: i2400m: fix some incorrect type warnings
@ 2021-02-12 21:36 Ayush
  0 siblings, 0 replies; 2+ messages in thread
From: Ayush @ 2021-02-12 21:36 UTC (permalink / raw)
  To: gregkh; +Cc: devel, arnd, kuba, johannes, lee.jones

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>
---
compile tested on linux-next (tag: next-20210212).

 drivers/staging/wimax/i2400m/tx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/tx.c b/drivers/staging/wimax/i2400m/tx.c
index e9436212fe54..8c01f42876ea 100644
--- a/drivers/staging/wimax/i2400m/tx.c
+++ b/drivers/staging/wimax/i2400m/tx.c
@@ -785,7 +785,7 @@ int i2400m_tx(struct i2400m *i2400m, const void *buf, size_t buf_len,
 		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 @@ struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *i2400m,
 		 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;
-- 
2.30.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] staging: wimax: i2400m: fix some incorrect type warnings
@ 2021-03-08 14:48 Darryl T. Agostinelli
  0 siblings, 0 replies; 2+ messages in thread
From: Darryl T. Agostinelli @ 2021-03-08 14:48 UTC (permalink / raw)
  To: devel; +Cc: gregkh, lee.jones, Darryl T. Agostinelli

Fix some "incorrect type in assignment" warnings reported by sparse in fw.c

sparse warnings:
wimax/i2400m/fw.c:266:27: warning: cast to restricted __le32
wimax/i2400m/fw.c:266:25: warning: incorrect type in assignment (different base types)
wimax/i2400m/fw.c:267:27: warning: cast to restricted __le32
wimax/i2400m/fw.c:267:25: warning: incorrect type in assignment (different base types)
wimax/i2400m/fw.c:268:27: warning: cast to restricted __le32
wimax/i2400m/fw.c:268:25: warning: incorrect type in assignment (different base types)
wimax/i2400m/fw.c:269:27: warning: cast to restricted __le32
wimax/i2400m/fw.c:269:25: warning: incorrect type in assignment (different base types)

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
---
 drivers/staging/wimax/i2400m/fw.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
index 92ea5c101e76..f0e43dbd02f6 100644
--- a/drivers/staging/wimax/i2400m/fw.c
+++ b/drivers/staging/wimax/i2400m/fw.c
@@ -263,10 +263,10 @@ int i2400m_barker_db_add(u32 barker_id)
 			return result;
 	}
 	barker = i2400m_barker_db + i2400m_barker_db_used++;
-	barker->data[0] = le32_to_cpu(barker_id);
-	barker->data[1] = le32_to_cpu(barker_id);
-	barker->data[2] = le32_to_cpu(barker_id);
-	barker->data[3] = le32_to_cpu(barker_id);
+	barker->data[0] = cpu_to_le32(barker_id);
+	barker->data[1] = cpu_to_le32(barker_id);
+	barker->data[2] = cpu_to_le32(barker_id);
+	barker->data[3] = cpu_to_le32(barker_id);
 	return 0;
 }
 
-- 
2.29.2

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-08 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 21:36 [PATCH] staging: wimax: i2400m: fix some incorrect type warnings Ayush
2021-03-08 14:48 Darryl T. Agostinelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).