staging: rtl8712: Remove multiple assignments
PATCH 1/1 staging: rtl8712: Remove multiple assignments
Remove multiple assignments by factorizing them to get rid of checkpatch warning. The semantic patch to solve the issue is as follows:
@@
expression x,y,z;
@@
-x=y=z;
+x=z;
+y=z;
--- drivers/staging/rtl8712/xmit_linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/xmit_linux.c +4 -2
@@ -38,8 +38,10 @@ static uint remainder_len(struct pkt_file *pfile)void _r8712_open_pktfile (_pkt *pktptr,struct pkt_file *pfile) { pfile->pkt = pktptr; - pfile->cur_addr = pfile->buf_start = pktptr->data; - pfile->pkt_len = pfile->buf_len = pktptr->len; + pfile->cur_addr = pktptr->data; + pfile->buf_start = pktptr->data; + pfile->pkt_len = pktptr->len; + pfile->buf_len = pktptr->len; pfile->cur_buffer = pfile->buf_start; }
Signature · 1 line
2.17.1
Quoted 21 lines · Vatsala Narang
Remove multiple assignments by factorizing them to get rid of checkpatch warning. The semantic patch to solve the issue is as follows:
@@
expression x,y,z;
@@(quoted diff) +2
-1-x=y=z; +x=z; +y=z;Signed-off-by Vatsala Narang <[email protected]>--- drivers/staging/rtl8712/xmit_linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/rtl8712/xmit_linux.c +0
-0
drivers/staging/rtl8712/xmit_linux.c static uint remainder_len(struct pkt_file *pfile) · line 42
Quoted 5 lines
drivers/staging/rtl8712/xmit_linux.c +0
-2@@ -38,8 +38,10 @@ static uint remainder_len(struct pkt_file *pfile)void _r8712_open_pktfile (_pkt *pktptr,struct pkt_file *pfile) { pfile->pkt = pktptr; - pfile->cur_addr = pfile->buf_start = pktptr->data; - pfile->pkt_len = pfile->buf_len = pktptr->len;
It was a good initiative to use Coccinelle for this, but I think the code was ok as is. It makes more clear that a certain set of fields all have the same value.
julia
Quoted 17 lines
drivers/staging/rtl8712/xmit_linux.c +4
-1+ pfile->cur_addr = pktptr->data; + pfile->buf_start = pktptr->data; + pfile->pkt_len = pktptr->len; + pfile->buf_len = pktptr->len; pfile->cur_buffer = pfile->buf_start; } --2.17.1
--
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/20190330005429.29931-1-vatsalanarang%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Actually checkpatch was giving warning for double assignments. I will keep
that in mind.
Thanks Julia