Skip to contentSkip to conversation

Remove unnecessary cast on void pointer

PATCH In review simran singhal 4 participants 11 messages Mar 4, 2017 – Mar 5, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v5 cover Remove unnecessary cast on void pointer

This patch-series removes unnecessary cast on void pointer in various drivers.

v5:
-Fixed compliation warning in lustre/lustre/llite/range_lock.c
which remain unfixed in v3.
v4:
-change the cover-letter subject
v3:
-Fixed compilation warning in lustre/lustre/llite/range_lock.c

simran singhal (5):
staging: nvec: Remove unnecessary cast on void pointer
staging: lustre: Remove unnecessary cast on void pointer
staging: lustre: lustre: Remove unnecessary cast on void pointer
staging: rts5208: Remove unnecessary cast on void pointer
staging: rtl8712: Remove unnecessary cast on void pointer

 drivers/staging/lustre/lustre/llite/range_lock.c |  2 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c      |  4 ++--
 drivers/staging/nvec/nvec_kbd.c                  |  2 +-
 drivers/staging/rtl8712/rtl8712_recv.c           | 11 +++++------
 drivers/staging/rts5208/rtsx_transport.c         |  3 +--
 5 files changed, 10 insertions(+), 12 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v5 1/5 staging: nvec: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:

@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)

---
 drivers/staging/nvec/nvec_kbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/nvec/nvec_kbd.c +1 -1
index e881e6b..a01f486 100644
@@ -58,7 +58,7 @@ static int nvec_keys_notifier(struct notifier_block *nb,
 			      unsigned long event_type, void *data)
 {
 	int code, state;
-	unsigned char *msg = (unsigned char *)data;
+	unsigned char *msg = data;
 
 	if (event_type == NVEC_KB_EVT) {
 		int _size = (msg[0] & (3 << 5)) >> 5;
Signature · 1 line
2.7.4
#2 lore raw

PATCH v5 2/5 staging: lustre: Remove unnecessary cast on void pointer

In reply to simran singhal

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)

---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +2 -2
index 271e189..09b46924 100644
@@ -640,7 +640,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg,
 	int			remote_gf_size = 0;
 	int			rc;
 
-	gf = (struct getinfo_fid2path *)karg;
+	gf = karg;
 	tgt = lmv_find_target(lmv, &gf->gf_fid);
 	if (IS_ERR(tgt))
 		return PTR_ERR(tgt);
@@ -657,7 +657,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg,
 		struct getinfo_fid2path *ori_gf;
 		char *ptr;
 
-		ori_gf = (struct getinfo_fid2path *)karg;
+		ori_gf = karg;
 		if (strlen(ori_gf->gf_path) +
 		    strlen(gf->gf_path) > ori_gf->gf_pathlen) {
 			rc = -EOVERFLOW;
Signature · 1 line
2.7.4
Reviewed-by on v5 2/5
#3 lore raw

Re: [PATCH v5 2/5] staging: lustre: Remove unnecessary cast on void pointer

Quoted 19 lines

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)

Quoted 1 line
Quoted 34 lines
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +2 -2
index 271e189..09b46924 100644
@@ -640,7 +640,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg,
 	int			remote_gf_size = 0;
 	int			rc;
 
-	gf = (struct getinfo_fid2path *)karg;
+	gf = karg;
 	tgt = lmv_find_target(lmv, &gf->gf_fid);
 	if (IS_ERR(tgt))
 		return PTR_ERR(tgt);
@@ -657,7 +657,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg,
 		struct getinfo_fid2path *ori_gf;
 		char *ptr;
 
-		ori_gf = (struct getinfo_fid2path *)karg;
+		ori_gf = karg;
 		if (strlen(ori_gf->gf_path) +
 		    strlen(gf->gf_path) > ori_gf->gf_pathlen) {
 			rc = -EOVERFLOW;
Signature · 6 lines
2.7.4

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#4 lore raw

PATCH v5 3/5 staging: lustre: lustre: Remove unnecessary cast on void pointer

In reply to simran singhal

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)

---

v5:
-Fixed compilation warnings.

 drivers/staging/lustre/lustre/llite/range_lock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/range_lock.c +1 -1
index 14148a0..161391b 100644
@@ -174,7 +174,7 @@ void range_unlock(struct range_lock_tree *tree, struct range_lock *lock)
  */
 static enum interval_iter range_lock_cb(struct interval_node *node, void *arg)
 {
-	struct range_lock *lock = (struct range_lock *)arg;
+	struct range_lock *lock = arg;
 	struct range_lock *overlap = node2rangelock(node);
 
 	lock->rl_blocking_ranges += overlap->rl_lock_count + 1;
Signature · 1 line
2.7.4
Reviewed-by on v5 3/5
#5 lore raw

Re: [PATCH v5 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer

Quoted 19 lines

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)

Quoted 1 line
Quoted 29 lines

---

v5:
-Fixed compilation warnings.

 drivers/staging/lustre/lustre/llite/range_lock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/range_lock.c +1 -1
index 14148a0..161391b 100644
@@ -174,7 +174,7 @@ void range_unlock(struct range_lock_tree *tree, struct range_lock *lock)
  */
 static enum interval_iter range_lock_cb(struct interval_node *node, void *arg)
 {
-	struct range_lock *lock = (struct range_lock *)arg;
+	struct range_lock *lock = arg;
 	struct range_lock *overlap = node2rangelock(node);
 
 	lock->rl_blocking_ranges += overlap->rl_lock_count + 1;
Signature · 6 lines
2.7.4

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#6 lore raw

PATCH v5 4/5 staging: rts5208: Remove unnecessary cast on void pointer

In reply to simran singhal

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)

---
 drivers/staging/rts5208/rtsx_transport.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rts5208/rtsx_transport.c +1 -2
index 2379901..8b57e17 100644
@@ -766,8 +766,7 @@ int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,
 		return -EIO;
 
 	if (use_sg) {
-		err = rtsx_transfer_sglist_adma(chip, card,
-						(struct scatterlist *)buf,
+		err = rtsx_transfer_sglist_adma(chip, card, buf,
 						use_sg, dma_dir, timeout);
 	} else {
 		err = rtsx_transfer_buf(chip, card, buf, len, dma_dir, timeout);
Signature · 1 line
2.7.4
#7 lore raw

PATCH v5 5/5 staging: rtl8712: Remove unnecessary cast on void pointer

In reply to simran singhal

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)

---
 drivers/staging/rtl8712/rtl8712_recv.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/staging/rtl8712/rtl8712_recv.c +5 -6
index 20fe45a..266ffef 100644
@@ -444,9 +444,9 @@ void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf)
 	u16 cmd_len, drvinfo_sz;
 	struct recv_stat *prxstat;
 
-	poffset = (u8 *)prxcmdbuf;
+	poffset = prxcmdbuf;
 	voffset = *(__le32 *)poffset;
-	prxstat = (struct recv_stat *)prxcmdbuf;
+	prxstat = prxcmdbuf;
 	drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16;
 	drvinfo_sz <<= 3;
 	poffset += RXDESC_SIZE + drvinfo_sz;
@@ -634,8 +634,7 @@ static int recv_indicatepkt_reorder(struct _adapter *padapter,
 void r8712_reordering_ctrl_timeout_handler(void *pcontext)
 {
 	unsigned long irql;
-	struct recv_reorder_ctrl *preorder_ctrl =
-				 (struct recv_reorder_ctrl *)pcontext;
+	struct recv_reorder_ctrl *preorder_ctrl = pcontext;
 	struct _adapter *padapter = preorder_ctrl->padapter;
 	struct  __queue *ppending_recvframe_queue =
 				 &preorder_ctrl->pending_recvframe_queue;
@@ -976,7 +975,7 @@ int recv_func(struct _adapter *padapter, void *pcontext)
 	struct  __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
 	struct	mlme_priv	*pmlmepriv = &padapter->mlmepriv;
 
-	prframe = (union recv_frame *)pcontext;
+	prframe = pcontext;
 	orig_prframe = prframe;
 	pattrib = &prframe->u.hdr.attrib;
 	if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
@@ -1124,7 +1123,7 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
 static void recv_tasklet(void *priv)
 {
 	struct sk_buff *pskb;
-	struct _adapter *padapter = (struct _adapter *)priv;
+	struct _adapter *padapter = priv;
 	struct recv_priv *precvpriv = &padapter->recvpriv;
 
 	while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) {
Signature · 1 line
2.7.4
Acked-by on the v5 series
#8 lore raw
In reply to simran singhal
Quoted 6 lines · simran singhal

This patch-series removes unnecessary cast on void pointer in various drivers.

v5:
-Fixed compliation warning in lustre/lustre/llite/range_lock.c
which remain unfixed in v3.

for the whole series.

Quoted 29 lines

v4:
-change the cover-letter subject
v3:
-Fixed compilation warning in lustre/lustre/llite/range_lock.c

simran singhal (5):
staging: nvec: Remove unnecessary cast on void pointer
staging: lustre: Remove unnecessary cast on void pointer
staging: lustre: lustre: Remove unnecessary cast on void pointer
staging: rts5208: Remove unnecessary cast on void pointer
staging: rtl8712: Remove unnecessary cast on void pointer

 drivers/staging/lustre/lustre/llite/range_lock.c |  2 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c      |  4 ++--
 drivers/staging/nvec/nvec_kbd.c                  |  2 +-
 drivers/staging/rtl8712/rtl8712_recv.c           | 11 +++++------
 drivers/staging/rts5208/rtsx_transport.c         |  3 +--
 5 files changed, 10 insertions(+), 12 deletions(-)

--
2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488641453-22575-1-git-send-email-singhalsimran0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#9 lore raw
In reply to simran singhal
Quoted 2 lines · simran singhal

This patch-series removes unnecessary cast on void pointer in various drivers.

Much better, thanks.

Trivia: (and it's probably not necessary to resend)

The cover letter should describe the subsystem being changed or ideally something like "treewide" if the series touches files throughout the kernel sources.

So this cover letter ideally would have a subject like:

Subject: [PATCH v5 0/5] staging: Remove unnecessary casts of void pointer

Quoted 8 lines

v5:
-Fixed compliation warning in lustre/lustre/llite/range_lock.c
which remain unfixed in v3.
v4:
-change the cover-letter subject
v3:
-Fixed compilation warning in lustre/lustre/llite/range_lock.c

Quoted 6 lines

simran singhal (5):
staging: nvec: Remove unnecessary cast on void pointer
staging: lustre: Remove unnecessary cast on void pointer
staging: lustre: lustre: Remove unnecessary cast on void pointer
staging: rts5208: Remove unnecessary cast on void pointer
staging: rtl8712: Remove unnecessary cast on void pointer

Some of these are acting on multiple instances.

Please try to use plural and singular descriptions where appropriate.

Quoted 6 lines
 drivers/staging/lustre/lustre/llite/range_lock.c |  2 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c      |  4 ++--
 drivers/staging/nvec/nvec_kbd.c                  |  2 +-
 drivers/staging/rtl8712/rtl8712_recv.c           | 11 +++++------
 drivers/staging/rts5208/rtsx_transport.c         |  3 +--
 5 files changed, 10 insertions(+), 12 deletions(-)
#10 lore raw
Quoted 31 lines · Joe Perches
Quoted 2 lines · simran singhal

This patch-series removes unnecessary cast on void pointer in various drivers.

Much better, thanks.

Trivia: (and it's probably not necessary to resend)

The cover letter should describe the subsystem being changed or ideally something like "treewide" if the series touches files throughout the kernel sources.

So this cover letter ideally would have a subject like:

Subject: [PATCH v5 0/5] staging: Remove unnecessary casts of void pointer

Quoted 8 lines

v5:
-Fixed compliation warning in lustre/lustre/llite/range_lock.c
which remain unfixed in v3.
v4:
-change the cover-letter subject
v3:
-Fixed compilation warning in lustre/lustre/llite/range_lock.c

Quoted 6 lines

simran singhal (5):
staging: nvec: Remove unnecessary cast on void pointer
staging: lustre: Remove unnecessary cast on void pointer
staging: lustre: lustre: Remove unnecessary cast on void pointer
staging: rts5208: Remove unnecessary cast on void pointer
staging: rtl8712: Remove unnecessary cast on void pointer

Quoted 5 lines

Some of these are acting on multiple instances.

Please try to use plural and singular descriptions where appropriate.

Thanks Joe,
Will keep this in mind from next time.

Quoted 7 lines
Quoted 6 lines
 drivers/staging/lustre/lustre/llite/range_lock.c |  2 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c      |  4 ++--
 drivers/staging/nvec/nvec_kbd.c                  |  2 +-
 drivers/staging/rtl8712/rtl8712_recv.c           | 11 +++++------
 drivers/staging/rts5208/rtsx_transport.c         |  3 +--
 5 files changed, 10 insertions(+), 12 deletions(-)