* [PATCH] staging: rtl8188eu: replace explicit NULL comparison
@ 2017-02-23 19:40 Gargi Sharma
2017-02-23 19:55 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Gargi Sharma @ 2017-02-23 19:40 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh, Gargi Sharma
Replace explicit NULL comparison with ! operator to
simplify code.
Found with Coccinelle script:
@@
expression ptr;
position p;
statement s0;
@@
ptr@p =
\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|usb_alloc_urb\|
alloc_netdev\|dev_alloc_skb\)(...)
... when != ptr
if (
(
+ !
ptr
- == NULL
)
) s0
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
---
drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
index e097c61..8bf8248 100644
--- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
@@ -72,7 +72,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
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]) {
DBG_88E("pxmitbuf->pxmit_urb[i]==NULL");
return _FAIL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: replace explicit NULL comparison
2017-02-23 19:40 [PATCH] staging: rtl8188eu: replace explicit NULL comparison Gargi Sharma
@ 2017-02-23 19:55 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2017-02-23 19:55 UTC (permalink / raw)
To: Gargi Sharma; +Cc: outreachy-kernel, gregkh
On Fri, 24 Feb 2017, Gargi Sharma wrote:
> Replace explicit NULL comparison with ! operator to
> simplify code.
>
> Found with Coccinelle script:
> @@
> expression ptr;
> position p;
> statement s0;
> @@
>
> ptr@p =
> \(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|usb_alloc_urb\|
> alloc_netdev\|dev_alloc_skb\)(...)
> ... when != ptr
>
> if (
> (
> + !
> ptr
> - == NULL
> )
> ) s0
>
> Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
> drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
> index e097c61..8bf8248 100644
> --- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
> +++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
> @@ -72,7 +72,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
>
> 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]) {
> DBG_88E("pxmitbuf->pxmit_urb[i]==NULL");
> return _FAIL;
> }
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1487878851-27132-1-git-send-email-gs051095%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-23 19:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23 19:40 [PATCH] staging: rtl8188eu: replace explicit NULL comparison Gargi Sharma
2017-02-23 19:55 ` [Outreachy kernel] " Julia Lawall
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.