staging: rtl8712: Replace explicit NULL comparison
PATCH 1/1 staging: rtl8712: Replace explicit NULL comparison
Replace explicit NULL comparison with ! operator.
Found with Coccinelle.
@@
expression e;
@@
- e == NULL
+ !e
--- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/xmit_linux.c +2 -2
@@ -131,7 +131,7 @@ int r8712_xmit_resource_alloc(struct _adapter *padapter,for (i =0 ; i <8 ; i++) { pxmitbuf->pxmit_urb[i] =usb_alloc_urb (0 ,GFP_KERNEL ); -if (pxmitbuf->pxmit_urb[i] ==NULL ) { +if (!pxmitbuf->pxmit_urb[i]) {netdev_err (padapter->pnetdev,"pxmitbuf->pxmit_urb[i] == NULL\n" );return _FAIL; }
@@ -171,7 +171,7 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev) goto _xmit_entry_drop; } pxmitframe =r8712_alloc_xmitframe (pxmitpriv); -if (pxmitframe ==NULL ) { +if (!pxmitframe) { ret =0 ; goto _xmit_entry_drop; }
--
2.1.4
Quoted 28 lines · Bhaktipriya Shridhar
Replace explicit NULL comparison with ! operator.
Found with Coccinelle.@@
expression e;
@@
- e == NULL
+ !eSigned-off-by Bhaktipriya Shridhar <[email protected]>--- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8712/xmit_linux.c +1
-1@@ -131,7 +131,7 @@ int r8712_xmit_resource_alloc(struct _adapter *padapter,for (i =0 ; i <8 ; i++) { pxmitbuf->pxmit_urb[i] =usb_alloc_urb (0 ,GFP_KERNEL ); -if (pxmitbuf->pxmit_urb[i] ==NULL ) { +if (!pxmitbuf->pxmit_urb[i]) {netdev_err (padapter->pnetdev,"pxmitbuf->pxmit_urb[i] == NULL\n" );return _FAIL; }
drivers/staging/rtl8712/xmit_linux.c int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev) · line 177
Quoted 8 lines
drivers/staging/rtl8712/xmit_linux.c +1
-1@@ -171,7 +171,7 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev) goto _xmit_entry_drop; } pxmitframe =r8712_alloc_xmitframe (pxmitpriv); -if (pxmitframe ==NULL ) { +if (!pxmitframe) { ret =0 ; goto _xmit_entry_drop; }
Nothing to do with your change, but it is strange that this function always returns 0. This function is stored in a ndo_start_xmit field in a net_device_ops structure. There should be many other such functions in the kernel. It could be interesting to see in what cases they fail, and what value they return in these cases. Another approach could be to use git blame on the lines that set ret, and see if the value was changed at some point.
julia
Quoted 10 lines
--
2.1.4Signature · 5 lines
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/20160218185430.GA3067%40Karyakshetra. For more options, visit https://groups.google.com/d/optout.