* [PATCH 1/4] Staging: rtl8712: rtl8712_efuse: Use !x instead of x == NULL.
2016-09-20 8:58 [PATCH 0/4] Staging: Use !x instead of x == NULL Sandhya Bankar
@ 2016-09-20 9:01 ` Sandhya Bankar
2016-09-20 9:04 ` [PATCH 2/4] Staging: rtl8712: rtl8712_recv: " Sandhya Bankar
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Sandhya Bankar @ 2016-09-20 9:01 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Larry.Finger, florian.c.schilhabel, gregkh
Use !x instead of x == NULL. This patch was found by checkpatch.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
drivers/staging/rtl8712/rtl8712_efuse.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl8712_efuse.c b/drivers/staging/rtl8712/rtl8712_efuse.c
index 76f60ba..205298e 100644
--- a/drivers/staging/rtl8712/rtl8712_efuse.c
+++ b/drivers/staging/rtl8712/rtl8712_efuse.c
@@ -248,7 +248,7 @@ u8 r8712_efuse_pg_packet_read(struct _adapter *padapter, u8 offset, u8 *data)
u8 tmpdata[PGPKT_DATA_SIZE];
u8 ret = true;
- if (data == NULL)
+ if (!data)
return false;
if (offset > 0x0f)
return false;
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/4] Staging: rtl8712: rtl8712_recv: Use !x instead of x == NULL
2016-09-20 8:58 [PATCH 0/4] Staging: Use !x instead of x == NULL Sandhya Bankar
2016-09-20 9:01 ` [PATCH 1/4] Staging: rtl8712: rtl8712_efuse: " Sandhya Bankar
@ 2016-09-20 9:04 ` Sandhya Bankar
2016-09-20 14:44 ` [Outreachy kernel] " Julia Lawall
2016-09-20 9:06 ` [PATCH 3/4] Staging: rtl8712: rtl8712_xmit: " Sandhya Bankar
2016-09-20 9:07 ` [PATCH 4/4] Staging: rtl8712: rtl871x_cmd: " Sandhya Bankar
3 siblings, 1 reply; 6+ messages in thread
From: Sandhya Bankar @ 2016-09-20 9:04 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Larry.Finger, florian.c.schilhabel, gregkh
Use !x instead of x == NULL. This patch was found by checkpatch.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
drivers/staging/rtl8712/rtl8712_recv.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 4027d1a..66f0e0a 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -60,7 +60,7 @@ int r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter *padapter)
_init_queue(&precvpriv->free_recv_buf_queue);
precvpriv->pallocated_recv_buf =
kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, GFP_ATOMIC);
- if (precvpriv->pallocated_recv_buf == NULL)
+ if (!precvpriv->pallocated_recv_buf)
return _FAIL;
precvpriv->precv_buf = precvpriv->pallocated_recv_buf + 4 -
((addr_t) (precvpriv->pallocated_recv_buf) & 3);
@@ -274,7 +274,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
fragnum = pfhdr->attrib.frag_num;
psta_addr = pfhdr->attrib.ta;
psta = r8712_get_stainfo(pstapriv, psta_addr);
- if (psta == NULL)
+ if (!psta)
pdefrag_q = NULL;
else
pdefrag_q = &psta->sta_recvpriv.defrag_q;
@@ -999,15 +999,15 @@ int recv_func(struct _adapter *padapter, void *pcontext)
}
process_phy_info(padapter, prframe);
prframe = r8712_decryptor(padapter, prframe);
- if (prframe == NULL) {
+ if (!prframe) {
retval = _FAIL;
goto _exit_recv_func;
}
prframe = r8712_recvframe_chk_defrag(padapter, prframe);
- if (prframe == NULL)
+ if (!prframe)
goto _exit_recv_func;
prframe = r8712_portctrl(padapter, prframe);
- if (prframe == NULL) {
+ if (!prframe) {
retval = _FAIL;
goto _exit_recv_func;
}
@@ -1065,7 +1065,7 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
if ((le32_to_cpu(prxstat->rxdw0) >> 23) & 0x01)
shift_sz = 2;
precvframe = r8712_alloc_recvframe(pfree_recv_queue);
- if (precvframe == NULL)
+ if (!precvframe)
goto _exit_recvbuf2recvframe;
INIT_LIST_HEAD(&precvframe->u.hdr.list);
precvframe->u.hdr.precvbuf = NULL; /*can't access the precvbuf*/
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [Outreachy kernel] [PATCH 2/4] Staging: rtl8712: rtl8712_recv: Use !x instead of x == NULL
2016-09-20 9:04 ` [PATCH 2/4] Staging: rtl8712: rtl8712_recv: " Sandhya Bankar
@ 2016-09-20 14:44 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2016-09-20 14:44 UTC (permalink / raw)
To: Sandhya Bankar
Cc: outreachy-kernel, Larry.Finger, florian.c.schilhabel, gregkh
On Tue, 20 Sep 2016, Sandhya Bankar wrote:
> Use !x instead of x == NULL. This patch was found by checkpatch.
>
> Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
> ---
> drivers/staging/rtl8712/rtl8712_recv.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
> index 4027d1a..66f0e0a 100644
> --- a/drivers/staging/rtl8712/rtl8712_recv.c
> +++ b/drivers/staging/rtl8712/rtl8712_recv.c
> @@ -60,7 +60,7 @@ int r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter *padapter)
> _init_queue(&precvpriv->free_recv_buf_queue);
> precvpriv->pallocated_recv_buf =
> kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, GFP_ATOMIC);
> - if (precvpriv->pallocated_recv_buf == NULL)
> + if (!precvpriv->pallocated_recv_buf)
> return _FAIL;
No relation to this patch, but it could be nice to think about how to get
rid of these non-standard return values. For example, the normal return
value for failure of kzalloc is -ENOMEM. This would require checking all
of the return points from this function, and then checking all of the call
sites of this function to see/adjust what values they expect.
julia
> precvpriv->precv_buf = precvpriv->pallocated_recv_buf + 4 -
> ((addr_t) (precvpriv->pallocated_recv_buf) & 3);
> @@ -274,7 +274,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
> fragnum = pfhdr->attrib.frag_num;
> psta_addr = pfhdr->attrib.ta;
> psta = r8712_get_stainfo(pstapriv, psta_addr);
> - if (psta == NULL)
> + if (!psta)
> pdefrag_q = NULL;
> else
> pdefrag_q = &psta->sta_recvpriv.defrag_q;
> @@ -999,15 +999,15 @@ int recv_func(struct _adapter *padapter, void *pcontext)
> }
> process_phy_info(padapter, prframe);
> prframe = r8712_decryptor(padapter, prframe);
> - if (prframe == NULL) {
> + if (!prframe) {
> retval = _FAIL;
> goto _exit_recv_func;
> }
> prframe = r8712_recvframe_chk_defrag(padapter, prframe);
> - if (prframe == NULL)
> + if (!prframe)
> goto _exit_recv_func;
> prframe = r8712_portctrl(padapter, prframe);
> - if (prframe == NULL) {
> + if (!prframe) {
> retval = _FAIL;
> goto _exit_recv_func;
> }
> @@ -1065,7 +1065,7 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
> if ((le32_to_cpu(prxstat->rxdw0) >> 23) & 0x01)
> shift_sz = 2;
> precvframe = r8712_alloc_recvframe(pfree_recv_queue);
> - if (precvframe == NULL)
> + if (!precvframe)
> goto _exit_recvbuf2recvframe;
> INIT_LIST_HEAD(&precvframe->u.hdr.list);
> precvframe->u.hdr.precvbuf = NULL; /*can't access the precvbuf*/
> --
> 1.7.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 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/27343d51184cdabfc675105edc04caa8b8c50bbe.1474360940.git.bankarsandhya512%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] Staging: rtl8712: rtl8712_xmit: Use !x instead of x == NULL
2016-09-20 8:58 [PATCH 0/4] Staging: Use !x instead of x == NULL Sandhya Bankar
2016-09-20 9:01 ` [PATCH 1/4] Staging: rtl8712: rtl8712_efuse: " Sandhya Bankar
2016-09-20 9:04 ` [PATCH 2/4] Staging: rtl8712: rtl8712_recv: " Sandhya Bankar
@ 2016-09-20 9:06 ` Sandhya Bankar
2016-09-20 9:07 ` [PATCH 4/4] Staging: rtl8712: rtl871x_cmd: " Sandhya Bankar
3 siblings, 0 replies; 6+ messages in thread
From: Sandhya Bankar @ 2016-09-20 9:06 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Larry.Finger, florian.c.schilhabel, gregkh
Use !x instead of x == NULL. This patch was found by checkpatch.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
drivers/staging/rtl8712/rtl8712_xmit.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c
index 4bbf76f..c4f03a6 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -629,7 +629,7 @@ int r8712_xmitframe_complete(struct _adapter *padapter,
phwxmits = pxmitpriv->hwxmits;
hwentry = pxmitpriv->hwxmit_entry;
- if (pxmitbuf == NULL) {
+ if (!pxmitbuf) {
pxmitbuf = r8712_alloc_xmitbuf(pxmitpriv);
if (!pxmitbuf)
return false;
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 4/4] Staging: rtl8712: rtl871x_cmd: Use !x instead of x == NULL.
2016-09-20 8:58 [PATCH 0/4] Staging: Use !x instead of x == NULL Sandhya Bankar
` (2 preceding siblings ...)
2016-09-20 9:06 ` [PATCH 3/4] Staging: rtl8712: rtl8712_xmit: " Sandhya Bankar
@ 2016-09-20 9:07 ` Sandhya Bankar
3 siblings, 0 replies; 6+ messages in thread
From: Sandhya Bankar @ 2016-09-20 9:07 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Larry.Finger, florian.c.schilhabel, gregkh
Use !x instead of x == NULL. This patch was found by checkpatch.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
drivers/staging/rtl8712/rtl871x_cmd.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index 51b6959..b7ee5e6 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -66,13 +66,13 @@ static sint _init_cmd_priv(struct cmd_priv *pcmdpriv)
pcmdpriv->cmd_seq = 1;
pcmdpriv->cmd_allocated_buf = kmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ,
GFP_ATOMIC);
- if (pcmdpriv->cmd_allocated_buf == NULL)
+ if (!pcmdpriv->cmd_allocated_buf)
return _FAIL;
pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ -
((addr_t)(pcmdpriv->cmd_allocated_buf) &
(CMDBUFF_ALIGN_SZ - 1));
pcmdpriv->rsp_allocated_buf = kmalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
- if (pcmdpriv->rsp_allocated_buf == NULL)
+ if (!pcmdpriv->rsp_allocated_buf)
return _FAIL;
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 -
((addr_t)(pcmdpriv->rsp_allocated_buf) & 3);
@@ -88,7 +88,7 @@ static sint _init_evt_priv(struct evt_priv *pevtpriv)
pevtpriv->event_seq = 0;
pevtpriv->evt_allocated_buf = kmalloc(MAX_EVTSZ + 4, GFP_ATOMIC);
- if (pevtpriv->evt_allocated_buf == NULL)
+ if (!pevtpriv->evt_allocated_buf)
return _FAIL;
pevtpriv->evt_buf = pevtpriv->evt_allocated_buf + 4 -
((addr_t)(pevtpriv->evt_allocated_buf) & 3);
@@ -123,7 +123,7 @@ static sint _enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
{
unsigned long irqL;
- if (obj == NULL)
+ if (!obj)
return _SUCCESS;
spin_lock_irqsave(&queue->lock, irqL);
list_add_tail(&obj->list, &queue->queue);
@@ -181,7 +181,7 @@ u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj)
unsigned long irqL;
struct __queue *queue;
- if (obj == NULL)
+ if (!obj)
return _SUCCESS;
if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag)
return _FAIL;
@@ -477,7 +477,7 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork)
}
}
psecnetwork = &psecuritypriv->sec_bss;
- if (psecnetwork == NULL) {
+ if (!psecnetwork) {
kfree(pcmd);
return _FAIL;
}
@@ -884,16 +884,16 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter,
if (!psta) {
psta = r8712_alloc_stainfo(&padapter->stapriv,
pnetwork->MacAddress);
- if (psta == NULL)
+ if (!psta)
goto createbss_cmd_fail;
}
r8712_indicate_connect(padapter);
} else {
pwlan = _r8712_alloc_network(pmlmepriv);
- if (pwlan == NULL) {
+ if (!pwlan) {
pwlan = r8712_get_oldest_wlan_network(
&pmlmepriv->scanned_queue);
- if (pwlan == NULL)
+ if (!pwlan)
goto createbss_cmd_fail;
pwlan->last_scanned = jiffies;
} else
@@ -925,7 +925,7 @@ void r8712_setstaKey_cmdrsp_callback(struct _adapter *padapter,
struct sta_info *psta = r8712_get_stainfo(pstapriv,
psetstakey_rsp->addr);
- if (psta == NULL)
+ if (!psta)
goto exit;
psta->aid = psta->mac_id = psetstakey_rsp->keyid; /*CAM_ID(CAM_ENTRY)*/
exit:
@@ -945,7 +945,7 @@ void r8712_setassocsta_cmdrsp_callback(struct _adapter *padapter,
struct sta_info *psta = r8712_get_stainfo(pstapriv,
passocsta_parm->addr);
- if (psta == NULL)
+ if (!psta)
return;
psta->aid = psta->mac_id = passocsta_rsp->cam_id;
spin_lock_irqsave(&pmlmepriv->lock, irqL);
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread