* [PATCH v3] staging: rtl8712: Make return of 0 explicit
@ 2016-02-25 10:47 Bhaktipriya Shridhar
0 siblings, 0 replies; only message in thread
From: Bhaktipriya Shridhar @ 2016-02-25 10:47 UTC (permalink / raw)
To: outreachy-kernel
Delete unnecessary local variable whose value is always 0 and
return 0 as the result.
The following Coccinelle script was used:
@@
identifier ret; expression E;
type T;
@@
(
- T ret;
|
- T ret = 0;
)
... when != \(ret=E
\|ret--\|ret++\|--ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\)
(
?-ret = 0;
)
... when != \(ret=E
\|ret--\|ret++\|--ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\)
(
return
- ret
+ 0
;
)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
---
Changes in v3:
-Changed Coccinelle script to remove all occurrences of the variable
-Changed Coccinelle script to replace every return associated with the
variable with return 0
drivers/staging/rtl8712/xmit_linux.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8712/xmit_linux.c b/drivers/staging/rtl8712/xmit_linux.c
index adb51f0..8c15308 100644
--- a/drivers/staging/rtl8712/xmit_linux.c
+++ b/drivers/staging/rtl8712/xmit_linux.c
@@ -163,19 +163,15 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev)
struct xmit_frame *pxmitframe = NULL;
struct _adapter *padapter = netdev_priv(pnetdev);
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- int ret = 0;
if (!r8712_if_up(padapter)) {
- ret = 0;
goto _xmit_entry_drop;
}
pxmitframe = r8712_alloc_xmitframe(pxmitpriv);
if (!pxmitframe) {
- ret = 0;
goto _xmit_entry_drop;
}
if ((!r8712_update_attrib(padapter, pkt, &pxmitframe->attrib))) {
- ret = 0;
goto _xmit_entry_drop;
}
padapter->ledpriv.LedControlHandler(padapter, LED_CTL_TX);
@@ -187,11 +183,11 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev)
}
pxmitpriv->tx_pkts++;
pxmitpriv->tx_bytes += pxmitframe->attrib.last_txcmdsz;
- return ret;
+ return 0;
_xmit_entry_drop:
if (pxmitframe)
r8712_free_xmitframe(pxmitpriv, pxmitframe);
pxmitpriv->tx_drop++;
dev_kfree_skb_any(pkt);
- return ret;
+ return 0;
}
--
2.1.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-25 10:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 10:47 [PATCH v3] staging: rtl8712: Make return of 0 explicit Bhaktipriya Shridhar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.