Skip to contentSkip to conversation

staging: wfx: remove unnecessary void pointer

PATCH In review Jules Irenge 2 participants 3 messages Oct 21, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: wfx: remove unnecessary void pointer

Remove unnecessary void pointers.
Issue detected and solved by coccinelle tool.
semantic use
@@expression e ;@@
-(void*)(e)
+e

---
 drivers/staging/wfx/bh.c       | 2 +-
 drivers/staging/wfx/bus_sdio.c | 2 +-
 drivers/staging/wfx/bus_spi.c  | 2 +-
 drivers/staging/wfx/sta.c      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/wfx/bh.c +1 -1
index 955ed3a1dd73..d7ad9227c9c4 100644
@@ -76,7 +76,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf)
 	hif = (struct hif_msg *)skb->data;
 	WARN(hif->encrypted & 0x1, "unsupported encryption type");
 	if (hif->encrypted == 0x2) {
-		if (wfx_sl_decode(wdev, (void *)hif)) {
+		if (wfx_sl_decode(wdev, hif)) {
 			dev_kfree_skb(skb);
 			// If frame was a confirmation, expect trouble in next
 			// exchange. However, it is harmless to fail to decode
drivers/staging/wfx/bus_sdio.c +1 -1
index 375e07d6d9ae..237a19b5fd16 100644
@@ -66,7 +66,7 @@ static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id,
 	if (reg_id == WFX_REG_IN_OUT_QUEUE)
 		sdio_addr |= bus->buf_id_tx << 7;
 	// FIXME: discards 'const' qualifier for src
-	ret = sdio_memcpy_toio(bus->func, sdio_addr, (void *)src, count);
+	ret = sdio_memcpy_toio(bus->func, sdio_addr, src, count);
 	if (!ret && reg_id == WFX_REG_IN_OUT_QUEUE)
 		bus->buf_id_tx = (bus->buf_id_tx + 1) % 32;
 
drivers/staging/wfx/bus_spi.c +1 -1
index ab0cda1e124f..bd74801e7461 100644
@@ -90,7 +90,7 @@ static int wfx_spi_copy_to_io(void *priv, unsigned int addr,
 	struct wfx_spi_priv *bus = priv;
 	u16 regaddr = (addr << 12) | (count / 2);
 	// FIXME: use a bounce buffer
-	u16 *src16 = (void *)src;
+	u16 *src16 = src;
 	int ret, i;
 	struct spi_message      m;
 	struct spi_transfer     t_addr = {
drivers/staging/wfx/sta.c +1 -1
index 688586e823c0..842158b7e805 100644
@@ -896,7 +896,7 @@ static int wfx_upload_beacon(struct wfx_vif *wvif)
 	/* TODO: Distill probe resp; remove TIM and any other beacon-specific
 	 * IEs
 	 */
-	mgmt = (void *)skb->data;
+	mgmt = skb->data;
 	mgmt->frame_control =
 		cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
 
Signature · 1 line
2.21.0
#1 lore raw
Quoted 59 lines · On Monday 21 October 2019 14:24:49 CEST Jules Irenge wrote:

Remove unnecessary void pointers.
Issue detected and solved by coccinelle tool.
semantic use
@@expression e ;@@

(quoted diff) +1 -1
-(void*)(e)
+e
---
 drivers/staging/wfx/bh.c       | 2 +-
 drivers/staging/wfx/bus_sdio.c | 2 +-
 drivers/staging/wfx/bus_spi.c  | 2 +-
 drivers/staging/wfx/sta.c      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/wfx/bh.c +1 -1
index 955ed3a1dd73..d7ad9227c9c4 100644
@@ -76,7 +76,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf)
        hif = (struct hif_msg *)skb->data;
        WARN(hif->encrypted & 0x1, "unsupported encryption type");
        if (hif->encrypted == 0x2) {
-               if (wfx_sl_decode(wdev, (void *)hif)) {
+               if (wfx_sl_decode(wdev, hif)) {
                        dev_kfree_skb(skb);
                        // If frame was a confirmation, expect trouble in next
                        // exchange. However, it is harmless to fail to decode
drivers/staging/wfx/bus_sdio.c +1 -1
index 375e07d6d9ae..237a19b5fd16 100644
@@ -66,7 +66,7 @@ static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id,
        if (reg_id == WFX_REG_IN_OUT_QUEUE)
                sdio_addr |= bus->buf_id_tx << 7;
        // FIXME: discards 'const' qualifier for src
-       ret = sdio_memcpy_toio(bus->func, sdio_addr, (void *)src, count);
+       ret = sdio_memcpy_toio(bus->func, sdio_addr, src, count);
        if (!ret && reg_id == WFX_REG_IN_OUT_QUEUE)
                bus->buf_id_tx = (bus->buf_id_tx + 1) % 32;
 
drivers/staging/wfx/bus_spi.c +1 -1
index ab0cda1e124f..bd74801e7461 100644
@@ -90,7 +90,7 @@ static int wfx_spi_copy_to_io(void *priv, unsigned int addr,
        struct wfx_spi_priv *bus = priv;
        u16 regaddr = (addr << 12) | (count / 2);
        // FIXME: use a bounce buffer
-       u16 *src16 = (void *)src;
+       u16 *src16 = src;
        int ret, i;
        struct spi_message      m;
        struct spi_transfer     t_addr = {
drivers/staging/wfx/sta.c +0 -0
index 688586e823c0..842158b7e805 100644

drivers/staging/wfx/sta.c static int wfx_upload_beacon(struct wfx_vif *wvif) · line 902

Quoted 8 lines
drivers/staging/wfx/sta.c +1 -1
@@ -896,7 +896,7 @@ static int wfx_upload_beacon(struct wfx_vif *wvif)
        /* TODO: Distill probe resp; remove TIM and any other beacon-specific
         * IEs
         */
-       mgmt = (void *)skb->data;
+       mgmt = skb->data;
        mgmt->frame_control =
                cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
 

Hello Jules,

Thank you for your work.

Did you check that the code continue to compile without warnings after applying this patch?

Signature · 1 line
Jérôme Pouiller
#2 lore raw
Quoted 70 lines · Jerome Pouiller
Quoted 59 lines · On Monday 21 October 2019 14:24:49 CEST Jules Irenge wrote:

Remove unnecessary void pointers.
Issue detected and solved by coccinelle tool.
semantic use
@@expression e ;@@

(quoted diff) +1 -1
-(void*)(e)
+e
---
 drivers/staging/wfx/bh.c       | 2 +-
 drivers/staging/wfx/bus_sdio.c | 2 +-
 drivers/staging/wfx/bus_spi.c  | 2 +-
 drivers/staging/wfx/sta.c      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/wfx/bh.c +1 -1
index 955ed3a1dd73..d7ad9227c9c4 100644
@@ -76,7 +76,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf)
        hif = (struct hif_msg *)skb->data;
        WARN(hif->encrypted & 0x1, "unsupported encryption type");
        if (hif->encrypted == 0x2) {
-               if (wfx_sl_decode(wdev, (void *)hif)) {
+               if (wfx_sl_decode(wdev, hif)) {
                        dev_kfree_skb(skb);
                        // If frame was a confirmation, expect trouble in next
                        // exchange. However, it is harmless to fail to decode
drivers/staging/wfx/bus_sdio.c +1 -1
index 375e07d6d9ae..237a19b5fd16 100644
@@ -66,7 +66,7 @@ static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id,
        if (reg_id == WFX_REG_IN_OUT_QUEUE)
                sdio_addr |= bus->buf_id_tx << 7;
        // FIXME: discards 'const' qualifier for src
-       ret = sdio_memcpy_toio(bus->func, sdio_addr, (void *)src, count);
+       ret = sdio_memcpy_toio(bus->func, sdio_addr, src, count);
        if (!ret && reg_id == WFX_REG_IN_OUT_QUEUE)
                bus->buf_id_tx = (bus->buf_id_tx + 1) % 32;
 
drivers/staging/wfx/bus_spi.c +1 -1
index ab0cda1e124f..bd74801e7461 100644
@@ -90,7 +90,7 @@ static int wfx_spi_copy_to_io(void *priv, unsigned int addr,
        struct wfx_spi_priv *bus = priv;
        u16 regaddr = (addr << 12) | (count / 2);
        // FIXME: use a bounce buffer
-       u16 *src16 = (void *)src;
+       u16 *src16 = src;
        int ret, i;
        struct spi_message      m;
        struct spi_transfer     t_addr = {
drivers/staging/wfx/sta.c +0 -0
index 688586e823c0..842158b7e805 100644

drivers/staging/wfx/sta.c static int wfx_upload_beacon(struct wfx_vif *wvif) · line 902

Quoted 8 lines
drivers/staging/wfx/sta.c +1 -1
@@ -896,7 +896,7 @@ static int wfx_upload_beacon(struct wfx_vif *wvif)
        /* TODO: Distill probe resp; remove TIM and any other beacon-specific
         * IEs
         */
-       mgmt = (void *)skb->data;
+       mgmt = skb->data;
        mgmt->frame_control =
                cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
 

Hello Jules,

Quoted 9 lines

Thank you for your work.

Did you check that the code continue to compile without warnings after applying this patch?

Signature · 1 line
J�r�me Pouiller

No,

I just checked now and it does not compile complaining of missing pointer argument on wsl wfx_sl_encode function.

Thanks for the feedback.

Jules