[PATCH 5/6] staging: ks7010: add endian non-specific variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sparse emits warning: restricted __le16 degrades to integer. This is
caused by a comparison between an endian type and a constant. Before
comparison can be safely done we need to convert the endian type to
the endianess of the cpu.

Declare kernel standard type and convert endian type with call to
le16_to_cpu().

Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
---
 drivers/staging/ks7010/ks7010_sdio.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 0fa13cd..6083b7e 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -280,12 +280,14 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer,
 	unsigned char rw_data;
 	struct hostif_hdr *hdr;
 	int rc;
+	u16 event;
 
 	hdr = (struct hostif_hdr *)buffer;
+	event = le16_to_cpu(hdr->event);
 
 	DPRINTK(4, "size=%d\n", hdr->size);
-	if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) {
-		DPRINTK(1, "unknown event=%04X\n", hdr->event);
+	if (event < HIF_DATA_REQ || HIF_REQ_MAX < event) {
+		DPRINTK(1, "unknown event=%04X\n", event);
 		return 0;
 	}
 
@@ -344,11 +346,13 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
 {
 	int result = 0;
 	struct hostif_hdr *hdr;
+	u16 event;
 
 	hdr = (struct hostif_hdr *)p;
+	event = le16_to_cpu(hdr->event);
 
-	if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) {
-		DPRINTK(1, "unknown event=%04X\n", hdr->event);
+	if (event < HIF_DATA_REQ || HIF_REQ_MAX < event) {
+		DPRINTK(1, "unknown event=%04X\n", event);
 		return 0;
 	}
 
-- 
2.7.4

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



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux