Staging: Use !x instead of x == NULL
cover Staging: Use !x instead of x == NULL
Use !x instead of x == NULL. This patch was found by checkpatch.
Sandhya Bankar (4):
Staging: rtl8712: rtl8712_efuse: Use !x instead of x == NULL.
Staging: rtl8712: rtl8712_recv: Use !x instead of x == NULL.
Staging: rtl8712: rtl8712_xmit: Use !x instead of x == NULL
Staging: rtl8712: rtl871x_cmd: Use !x instead of x == NULL.
drivers/staging/rtl8712/rtl8712_efuse.c | 2 +- drivers/staging/rtl8712/rtl8712_recv.c | 12 ++++++------ drivers/staging/rtl8712/rtl8712_xmit.c | 2 +- drivers/staging/rtl8712/rtl871x_cmd.c | 22 +++++++++++----------- 4 files changed, 19 insertions(+), 19 deletions(-)
PATCH 1/4 Staging: rtl8712: rtl8712_efuse: Use !x instead of x == NULL.
Use !x instead of x == NULL. This patch was found by checkpatch.
--- drivers/staging/rtl8712/rtl8712_efuse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/rtl8712/rtl8712_efuse.c +1 -1
@@ -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;
Signature · 1 line
1.7.1
PATCH 2/4 Staging: rtl8712: rtl8712_recv: Use !x instead of x == NULL
In reply to Sandhya BankarUse !x instead of x == NULL. This patch was found by checkpatch.
--- drivers/staging/rtl8712/rtl8712_recv.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8712/rtl8712_recv.c +6 -6
@@ -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*/
Signature · 1 line
1.7.1
Re: [Outreachy kernel] [PATCH 2/4] Staging: rtl8712: rtl8712_recv: Use !x instead of x == NULL
Quoted 12 lines · Sandhya Bankar
Use !x instead of x == NULL. This patch was found by checkpatch.
Signed-off-by Sandhya Bankar <[email protected]>--- drivers/staging/rtl8712/rtl8712_recv.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtl8712/rtl8712_recv.c +0
-0
drivers/staging/rtl8712/rtl8712_recv.c int r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter *padapter) · line 64
Quoted 6 lines
drivers/staging/rtl8712/rtl8712_recv.c +1
-1@@ -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
Quoted 49 lines
drivers/staging/rtl8712/rtl8712_recv.c +5
-6precvpriv->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 [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/27343d51184cdabfc675105edc04caa8b8c50bbe.1474360940.git.bankarsandhya512%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH 3/4 Staging: rtl8712: rtl8712_xmit: Use !x instead of x == NULL
In reply to Sandhya BankarUse !x instead of x == NULL. This patch was found by checkpatch.
--- drivers/staging/rtl8712/rtl8712_xmit.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/rtl8712/rtl8712_xmit.c +1 -1
@@ -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;
Signature · 1 line
1.7.1
PATCH 4/4 Staging: rtl8712: rtl871x_cmd: Use !x instead of x == NULL.
In reply to Sandhya BankarUse !x instead of x == NULL. This patch was found by checkpatch.
--- drivers/staging/rtl8712/rtl871x_cmd.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
drivers/staging/rtl8712/rtl871x_cmd.c +11 -11
@@ -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);
Signature · 1 line
1.7.1