Commit d8062f6a authored by Michael Straube's avatar Michael Straube Committed by Greg Kroah-Hartman

staging: r8188eu: clean up comparsions to NULL in os_dep directory

Clean up comparsions to NULL in the os_dep directory reported by
checkpatch.

x == NULL -> !x
x != NULL -> x
Signed-off-by: default avatarMichael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20210730130204.18229-1-straube.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 792a00c1
...@@ -178,7 +178,7 @@ void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *pst ...@@ -178,7 +178,7 @@ void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *pst
union iwreq_data wrqu; union iwreq_data wrqu;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
if (psta == NULL) if (!psta)
return; return;
if (psta->aid > NUM_STA) if (psta->aid > NUM_STA)
...@@ -201,7 +201,7 @@ void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info * ...@@ -201,7 +201,7 @@ void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info *
union iwreq_data wrqu; union iwreq_data wrqu;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
if (psta == NULL) if (!psta)
return; return;
if (psta->aid > NUM_STA) if (psta->aid > NUM_STA)
......
...@@ -175,11 +175,11 @@ void rtw_proc_init_one(struct net_device *dev) ...@@ -175,11 +175,11 @@ void rtw_proc_init_one(struct net_device *dev)
struct adapter *padapter = rtw_netdev_priv(dev); struct adapter *padapter = rtw_netdev_priv(dev);
u8 rf_type; u8 rf_type;
if (rtw_proc == NULL) { if (!rtw_proc) {
memcpy(rtw_proc_name, DRV_NAME, sizeof(DRV_NAME)); memcpy(rtw_proc_name, DRV_NAME, sizeof(DRV_NAME));
rtw_proc = create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net); rtw_proc = create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net);
if (rtw_proc == NULL) { if (!rtw_proc) {
DBG_88E(KERN_ERR "Unable to create rtw_proc directory\n"); DBG_88E(KERN_ERR "Unable to create rtw_proc directory\n");
return; return;
} }
...@@ -191,12 +191,12 @@ void rtw_proc_init_one(struct net_device *dev) ...@@ -191,12 +191,12 @@ void rtw_proc_init_one(struct net_device *dev)
} }
} }
if (padapter->dir_dev == NULL) { if (!padapter->dir_dev) {
padapter->dir_dev = create_proc_entry(dev->name, padapter->dir_dev = create_proc_entry(dev->name,
S_IFDIR | S_IRUGO | S_IXUGO, S_IFDIR | S_IRUGO | S_IXUGO,
rtw_proc); rtw_proc);
dir_dev = padapter->dir_dev; dir_dev = padapter->dir_dev;
if (dir_dev == NULL) { if (!dir_dev) {
if (rtw_proc_cnt == 0) { if (rtw_proc_cnt == 0) {
if (rtw_proc) { if (rtw_proc) {
remove_proc_entry(rtw_proc_name, init_net.proc_net); remove_proc_entry(rtw_proc_name, init_net.proc_net);
...@@ -721,7 +721,7 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) ...@@ -721,7 +721,7 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter)
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+init_net_dev\n")); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+init_net_dev\n"));
if (old_padapter != NULL) if (old_padapter)
pnetdev = rtw_alloc_etherdev_with_old_priv(sizeof(struct adapter), (void *)old_padapter); pnetdev = rtw_alloc_etherdev_with_old_priv(sizeof(struct adapter), (void *)old_padapter);
else else
pnetdev = rtw_alloc_etherdev(sizeof(struct adapter)); pnetdev = rtw_alloc_etherdev(sizeof(struct adapter));
...@@ -1007,7 +1007,7 @@ u8 rtw_free_drv_sw(struct adapter *padapter) ...@@ -1007,7 +1007,7 @@ u8 rtw_free_drv_sw(struct adapter *padapter)
} }
/* clear pbuddystruct adapter to avoid access wrong pointer. */ /* clear pbuddystruct adapter to avoid access wrong pointer. */
if (padapter->pbuddy_adapter != NULL) if (padapter->pbuddy_adapter)
padapter->pbuddy_adapter->pbuddy_adapter = NULL; padapter->pbuddy_adapter->pbuddy_adapter = NULL;
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-rtw_free_drv_sw\n")); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-rtw_free_drv_sw\n"));
......
...@@ -48,7 +48,7 @@ inline u8 *_rtw_zvmalloc(u32 sz) ...@@ -48,7 +48,7 @@ inline u8 *_rtw_zvmalloc(u32 sz)
{ {
u8 *pbuf; u8 *pbuf;
pbuf = _rtw_vmalloc(sz); pbuf = _rtw_vmalloc(sz);
if (pbuf != NULL) if (pbuf)
memset(pbuf, 0, sz); memset(pbuf, 0, sz);
return pbuf; return pbuf;
} }
...@@ -70,7 +70,7 @@ u8 *_rtw_zmalloc(u32 sz) ...@@ -70,7 +70,7 @@ u8 *_rtw_zmalloc(u32 sz)
{ {
u8 *pbuf = _rtw_malloc(sz); u8 *pbuf = _rtw_malloc(sz);
if (pbuf != NULL) if (pbuf)
memset(pbuf, 0, sz); memset(pbuf, 0, sz);
return pbuf; return pbuf;
} }
...@@ -80,7 +80,7 @@ void *rtw_malloc2d(int h, int w, int size) ...@@ -80,7 +80,7 @@ void *rtw_malloc2d(int h, int w, int size)
int j; int j;
void **a = (void **)rtw_zmalloc(h*sizeof(void *) + h*w*size); void **a = (void **)rtw_zmalloc(h*sizeof(void *) + h*w*size);
if (a == NULL) { if (!a) {
pr_info("%s: alloc memory fail!\n", __func__); pr_info("%s: alloc memory fail!\n", __func__);
return NULL; return NULL;
} }
......
...@@ -42,7 +42,7 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, ...@@ -42,7 +42,7 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
precvbuf->irp_pending = false; precvbuf->irp_pending = false;
precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL); precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL);
if (precvbuf->purb == NULL) if (!precvbuf->purb)
res = _FAIL; res = _FAIL;
precvbuf->pskb = NULL; precvbuf->pskb = NULL;
precvbuf->reuse = false; precvbuf->reuse = false;
...@@ -118,7 +118,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, ...@@ -118,7 +118,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
pfree_recv_queue = &(precvpriv->free_recv_queue); pfree_recv_queue = &(precvpriv->free_recv_queue);
skb = precv_frame->pkt; skb = precv_frame->pkt;
if (skb == NULL) { if (!skb) {
RT_TRACE(_module_recv_osdep_c_, _drv_err_, RT_TRACE(_module_recv_osdep_c_, _drv_err_,
("rtw_recv_indicatepkt():skb == NULL something wrong!!!!\n")); ("rtw_recv_indicatepkt():skb == NULL something wrong!!!!\n"));
goto _recv_indicatepkt_drop; goto _recv_indicatepkt_drop;
......
...@@ -120,7 +120,7 @@ static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj) ...@@ -120,7 +120,7 @@ static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj)
_rtw_mutex_init(&dvobj->usb_vendor_req_mutex); _rtw_mutex_init(&dvobj->usb_vendor_req_mutex);
dvobj->usb_alloc_vendor_req_buf = rtw_zmalloc(MAX_USB_IO_CTL_SIZE); dvobj->usb_alloc_vendor_req_buf = rtw_zmalloc(MAX_USB_IO_CTL_SIZE);
if (dvobj->usb_alloc_vendor_req_buf == NULL) { if (!dvobj->usb_alloc_vendor_req_buf) {
DBG_88E("alloc usb_vendor_req_buf failed... /n"); DBG_88E("alloc usb_vendor_req_buf failed... /n");
rst = _FAIL; rst = _FAIL;
goto exit; goto exit;
...@@ -152,7 +152,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) ...@@ -152,7 +152,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
struct usb_device *pusbd; struct usb_device *pusbd;
pdvobjpriv = (struct dvobj_priv *)rtw_zmalloc(sizeof(*pdvobjpriv)); pdvobjpriv = (struct dvobj_priv *)rtw_zmalloc(sizeof(*pdvobjpriv));
if (pdvobjpriv == NULL) if (!pdvobjpriv)
goto exit; goto exit;
pdvobjpriv->pusbintf = usb_intf; pdvobjpriv->pusbintf = usb_intf;
...@@ -603,7 +603,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, ...@@ -603,7 +603,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
int status = _FAIL; int status = _FAIL;
padapter = (struct adapter *)rtw_zvmalloc(sizeof(*padapter)); padapter = (struct adapter *)rtw_zvmalloc(sizeof(*padapter));
if (padapter == NULL) if (!padapter)
goto exit; goto exit;
padapter->dvobj = dvobj; padapter->dvobj = dvobj;
dvobj->if1 = padapter; dvobj->if1 = padapter;
...@@ -620,7 +620,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, ...@@ -620,7 +620,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
goto free_adapter; goto free_adapter;
pnetdev = rtw_init_netdev(padapter); pnetdev = rtw_init_netdev(padapter);
if (pnetdev == NULL) if (!pnetdev)
goto handle_dualmac; goto handle_dualmac;
SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj)); SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj));
padapter = rtw_netdev_priv(pnetdev); padapter = rtw_netdev_priv(pnetdev);
...@@ -753,14 +753,14 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device ...@@ -753,14 +753,14 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device
/* Initialize dvobj_priv */ /* Initialize dvobj_priv */
dvobj = usb_dvobj_init(pusb_intf); dvobj = usb_dvobj_init(pusb_intf);
if (dvobj == NULL) { if (!dvobj) {
RT_TRACE(_module_hci_intfs_c_, _drv_err_, RT_TRACE(_module_hci_intfs_c_, _drv_err_,
("initialize device object priv Failed!\n")); ("initialize device object priv Failed!\n"));
goto exit; goto exit;
} }
if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid); if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid);
if (if1 == NULL) { if (!if1) {
DBG_88E("rtw_init_primarystruct adapter Failed!\n"); DBG_88E("rtw_init_primarystruct adapter Failed!\n");
goto free_dvobj; goto free_dvobj;
} }
......
...@@ -78,7 +78,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb ...@@ -78,7 +78,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
int i; int i;
pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz); pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
if (pxmitbuf->pallocated_buf == NULL) if (!pxmitbuf->pallocated_buf)
return _FAIL; return _FAIL;
pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ); pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
...@@ -86,7 +86,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb ...@@ -86,7 +86,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); 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"); DBG_88E("pxmitbuf->pxmit_urb[i]==NULL");
return _FAIL; return _FAIL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment