Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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

x == NULL -> !x
x != NULL -> x

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20210801084614.4328-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Michael Straube and committed by
Greg Kroah-Hartman
552838fd 725a3f1c

+280 -280
+11 -11
drivers/staging/r8188eu/core/rtw_ap.c
··· 67 67 tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); 68 68 69 69 p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_); 70 - if (p != NULL && tim_ielen > 0) { 70 + if (p && tim_ielen > 0) { 71 71 tim_ielen += 2; 72 72 premainder_ie = p+tim_ielen; 73 73 tim_ie_offset = (int)(p - pie); ··· 83 83 84 84 /* get supported rates len */ 85 85 p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)); 86 - if (p != NULL) 86 + if (p) 87 87 offset += tmp_len+2; 88 88 89 89 /* DS Parameter Set IE, len = 3 */ ··· 164 164 i += (pIE->Length + 2); 165 165 } 166 166 167 - if (p != NULL && ielen > 0) { 167 + if (p && ielen > 0) { 168 168 ielen += 2; 169 169 170 170 premainder_ie = p+ielen; ··· 211 211 212 212 p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, index, &ielen, 213 213 pnetwork->IELength - _FIXED_IE_LENGTH_); 214 - if (p != NULL && ielen > 0) { 214 + if (p && ielen > 0) { 215 215 ielen += 2; 216 216 217 217 premainder_ie = p+ielen; ··· 909 909 memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX); 910 910 /* get supported rates */ 911 911 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); 912 - if (p != NULL) { 912 + if (p) { 913 913 memcpy(supportRate, p+2, ie_len); 914 914 supportRateNum = ie_len; 915 915 } 916 916 917 917 /* get ext_supported rates */ 918 918 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_); 919 - if (p != NULL) { 919 + if (p) { 920 920 memcpy(supportRate+supportRateNum, p+2, ie_len); 921 921 supportRateNum += ie_len; 922 922 } ··· 978 978 } 979 979 break; 980 980 } 981 - if ((p == NULL) || (ie_len == 0)) 981 + if (!p || ie_len == 0) 982 982 break; 983 983 } 984 984 ··· 1002 1002 break; 1003 1003 } 1004 1004 1005 - if ((p == NULL) || (ie_len == 0)) 1005 + if (!p || ie_len == 0) 1006 1006 break; 1007 1007 } 1008 1008 } ··· 1089 1089 psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress); 1090 1090 if (!psta) { 1091 1091 psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress); 1092 - if (psta == NULL) 1092 + if (!psta) 1093 1093 return _FAIL; 1094 1094 } 1095 1095 ··· 1292 1292 1293 1293 pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen); 1294 1294 1295 - if (pwps_ie == NULL || wps_ielen == 0) 1295 + if (!pwps_ie || wps_ielen == 0) 1296 1296 return; 1297 1297 1298 1298 wps_offset = (uint)(pwps_ie-ie); ··· 1308 1308 } 1309 1309 1310 1310 pwps_ie_src = pmlmepriv->wps_beacon_ie; 1311 - if (pwps_ie_src == NULL) 1311 + if (!pwps_ie_src) 1312 1312 return; 1313 1313 1314 1314 wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
+14 -14
drivers/staging/r8188eu/core/rtw_br_ext.c
··· 336 336 { 337 337 /* Caller must spin_lock already! */ 338 338 ent->next_hash = priv->nethash[hash]; 339 - if (ent->next_hash != NULL) 339 + if (ent->next_hash) 340 340 ent->next_hash->pprev_hash = &ent->next_hash; 341 341 priv->nethash[hash] = ent; 342 342 ent->pprev_hash = &priv->nethash[hash]; ··· 346 346 { 347 347 /* Caller must spin_lock already! */ 348 348 *(ent->pprev_hash) = ent->next_hash; 349 - if (ent->next_hash != NULL) 349 + if (ent->next_hash) 350 350 ent->next_hash->pprev_hash = ent->pprev_hash; 351 351 ent->next_hash = NULL; 352 352 ent->pprev_hash = NULL; ··· 360 360 spin_lock_bh(&priv->br_ext_lock); 361 361 362 362 db = priv->nethash[__nat25_network_hash(networkAddr)]; 363 - while (db != NULL) { 363 + while (db) { 364 364 if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { 365 365 if (!__nat25_has_expired(priv, db)) { 366 366 /* replace the destination mac address */ ··· 411 411 spin_lock_bh(&priv->br_ext_lock); 412 412 hash = __nat25_network_hash(networkAddr); 413 413 db = priv->nethash[hash]; 414 - while (db != NULL) { 414 + while (db) { 415 415 if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { 416 416 memcpy(db->macAddr, macAddr, ETH_ALEN); 417 417 db->ageing_timer = jiffies; ··· 421 421 db = db->next_hash; 422 422 } 423 423 db = (struct nat25_network_db_entry *) rtw_malloc(sizeof(*db)); 424 - if (db == NULL) { 424 + if (!db) { 425 425 spin_unlock_bh(&priv->br_ext_lock); 426 426 return; 427 427 } ··· 452 452 for (i = 0; i < NAT25_HASH_SIZE; i++) { 453 453 struct nat25_network_db_entry *f; 454 454 f = priv->nethash[i]; 455 - while (f != NULL) { 455 + while (f) { 456 456 struct nat25_network_db_entry *g; 457 457 458 458 g = f->next_hash; ··· 479 479 struct nat25_network_db_entry *f; 480 480 f = priv->nethash[i]; 481 481 482 - while (f != NULL) { 482 + while (f) { 483 483 struct nat25_network_db_entry *g; 484 484 g = f->next_hash; 485 485 ··· 506 506 unsigned char networkAddr[MAX_NETWORK_ADDR_LEN]; 507 507 unsigned int tmp; 508 508 509 - if (skb == NULL) 509 + if (!skb) 510 510 return -1; 511 511 512 512 if ((method <= NAT25_MIN) || (method >= NAT25_MAX)) ··· 675 675 } 676 676 677 677 /* IPX */ 678 - if (ipx != NULL) { 678 + if (ipx) { 679 679 switch (method) { 680 680 case NAT25_CHECK: 681 681 if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) ··· 732 732 default: 733 733 return -1; 734 734 } 735 - } else if (ea != NULL) { 735 + } else if (ea) { 736 736 /* Sanity check fields. */ 737 737 if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) { 738 738 DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n"); ··· 775 775 default: 776 776 return -1; 777 777 } 778 - } else if (ddp != NULL) { 778 + } else if (ddp) { 779 779 switch (method) { 780 780 case NAT25_CHECK: 781 781 return -1; ··· 900 900 int offset = 0; 901 901 902 902 ptr = __nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID)); 903 - if (ptr == NULL) { 903 + if (!ptr) { 904 904 DEBUG_ERR("Fail to find PTT_RELAY_SID in FADO!\n"); 905 905 return -1; 906 906 } ··· 1132 1132 1133 1133 void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb) 1134 1134 { 1135 - if (skb == NULL) 1135 + if (!skb) 1136 1136 return; 1137 1137 1138 1138 if (!priv->ethBrExtInfo.dhcp_bcst_disable) { ··· 1182 1182 __nat25_generate_ipv4_network_addr(networkAddr, (unsigned int *)ipAddr); 1183 1183 hash = __nat25_network_hash(networkAddr); 1184 1184 db = priv->nethash[hash]; 1185 - while (db != NULL) { 1185 + while (db) { 1186 1186 if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { 1187 1187 return (void *)db; 1188 1188 }
+79 -79
drivers/staging/r8188eu/core/rtw_cmd.c
··· 33 33 pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, 34 34 GFP_KERNEL); 35 35 36 - if (pcmdpriv->cmd_allocated_buf == NULL) { 36 + if (!pcmdpriv->cmd_allocated_buf) { 37 37 res = _FAIL; 38 38 goto exit; 39 39 } ··· 42 42 43 43 pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_KERNEL); 44 44 45 - if (pcmdpriv->rsp_allocated_buf == NULL) { 45 + if (!pcmdpriv->rsp_allocated_buf) { 46 46 res = _FAIL; 47 47 goto exit; 48 48 } ··· 85 85 86 86 while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) { 87 87 void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue); 88 - if (c2h != NULL && c2h != (void *)pevtpriv) 88 + if (c2h && c2h != (void *)pevtpriv) 89 89 kfree(c2h); 90 90 } 91 91 RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("-rtw_free_evt_priv\n")); ··· 121 121 { 122 122 unsigned long flags; 123 123 124 - if (obj == NULL) 124 + if (!obj) 125 125 goto exit; 126 126 127 127 spin_lock_irqsave(&queue->lock, flags); ··· 207 207 int res = _FAIL; 208 208 struct adapter *padapter = pcmdpriv->padapter; 209 209 210 - if (cmd_obj == NULL) 210 + if (!cmd_obj) 211 211 goto exit; 212 212 213 213 cmd_obj->padapter = padapter; ··· 253 253 kfree(pcmd->parmbuf); 254 254 } 255 255 256 - if (pcmd->rsp != NULL) { 256 + if (pcmd->rsp) { 257 257 if (pcmd->rspsz != 0) { 258 258 /* free rsp in cmd_obj */ 259 259 kfree(pcmd->rsp); ··· 337 337 /* call callback function for post-processed */ 338 338 if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) { 339 339 pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; 340 - if (pcmd_callback == NULL) { 340 + if (!pcmd_callback) { 341 341 RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("mlme_cmd_hdl(): pcmd_callback = 0x%p, cmdcode = 0x%x\n", pcmd_callback, pcmd->cmdcode)); 342 342 rtw_free_cmd_obj(pcmd); 343 343 } else { ··· 358 358 /* free all cmd_obj resources */ 359 359 do { 360 360 pcmd = rtw_dequeue_cmd(pcmdpriv); 361 - if (pcmd == NULL) 361 + if (!pcmd) 362 362 break; 363 363 364 364 /* DBG_88E("%s: leaving... drop cmdcode:%u\n", __func__, pcmd->cmdcode); */ ··· 380 380 u8 ret = _SUCCESS; 381 381 382 382 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 383 - if (ph2c == NULL) { 383 + if (!ph2c) { 384 384 ret = _FAIL; 385 385 goto exit; 386 386 } 387 387 388 388 psetusbsuspend = kzalloc(sizeof(struct usb_suspend_parm), GFP_ATOMIC); 389 - if (psetusbsuspend == NULL) { 389 + if (!psetusbsuspend) { 390 390 kfree(ph2c); 391 391 ret = _FAIL; 392 392 goto exit; ··· 426 426 } 427 427 428 428 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 429 - if (ph2c == NULL) 429 + if (!ph2c) 430 430 return _FAIL; 431 431 432 432 psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); 433 - if (psurveyPara == NULL) { 433 + if (!psurveyPara) { 434 434 kfree(ph2c); 435 435 return _FAIL; 436 436 } ··· 499 499 u8 res = _SUCCESS; 500 500 501 501 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 502 - if (ph2c == NULL) { 502 + if (!ph2c) { 503 503 res = _FAIL; 504 504 goto exit; 505 505 } 506 506 507 507 pbsetdataratepara = kzalloc(sizeof(struct setdatarate_parm), GFP_ATOMIC); 508 - if (pbsetdataratepara == NULL) { 508 + if (!pbsetdataratepara) { 509 509 kfree(ph2c); 510 510 res = _FAIL; 511 511 goto exit; ··· 528 528 u8 res = _SUCCESS; 529 529 530 530 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 531 - if (ph2c == NULL) { 531 + if (!ph2c) { 532 532 res = _FAIL; 533 533 goto exit; 534 534 } 535 535 pssetbasicratepara = kzalloc(sizeof(struct setbasicrate_parm), GFP_ATOMIC); 536 536 537 - if (pssetbasicratepara == NULL) { 537 + if (!pssetbasicratepara) { 538 538 kfree(ph2c); 539 539 res = _FAIL; 540 540 goto exit; ··· 565 565 u8 res = _SUCCESS; 566 566 567 567 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 568 - if (ph2c == NULL) { 568 + if (!ph2c) { 569 569 res = _FAIL; 570 570 goto exit; 571 571 } 572 572 psetphypara = kzalloc(sizeof(struct setphy_parm), GFP_ATOMIC); 573 573 574 - if (psetphypara == NULL) { 574 + if (!psetphypara) { 575 575 kfree(ph2c); 576 576 res = _FAIL; 577 577 goto exit; ··· 598 598 u8 res = _SUCCESS; 599 599 600 600 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 601 - if (ph2c == NULL) { 601 + if (!ph2c) { 602 602 res = _FAIL; 603 603 goto exit; 604 604 } 605 605 pwritebbparm = kzalloc(sizeof(struct writeBB_parm), GFP_ATOMIC); 606 606 607 - if (pwritebbparm == NULL) { 607 + if (!pwritebbparm) { 608 608 kfree(ph2c); 609 609 res = _FAIL; 610 610 goto exit; ··· 629 629 u8 res = _SUCCESS; 630 630 631 631 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 632 - if (ph2c == NULL) { 632 + if (!ph2c) { 633 633 res = _FAIL; 634 634 goto exit; 635 635 } 636 636 prdbbparm = kzalloc(sizeof(struct readBB_parm), GFP_ATOMIC); 637 637 638 - if (prdbbparm == NULL) { 638 + if (!prdbbparm) { 639 639 kfree(ph2c); 640 640 return _FAIL; 641 641 } ··· 663 663 u8 res = _SUCCESS; 664 664 665 665 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 666 - if (ph2c == NULL) { 666 + if (!ph2c) { 667 667 res = _FAIL; 668 668 goto exit; 669 669 } 670 670 pwriterfparm = kzalloc(sizeof(struct writeRF_parm), GFP_ATOMIC); 671 671 672 - if (pwriterfparm == NULL) { 672 + if (!pwriterfparm) { 673 673 kfree(ph2c); 674 674 res = _FAIL; 675 675 goto exit; ··· 694 694 u8 res = _SUCCESS; 695 695 696 696 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 697 - if (ph2c == NULL) { 697 + if (!ph2c) { 698 698 res = _FAIL; 699 699 goto exit; 700 700 } 701 701 702 702 prdrfparm = kzalloc(sizeof(struct readRF_parm), GFP_ATOMIC); 703 - if (prdrfparm == NULL) { 703 + if (!prdrfparm) { 704 704 kfree(ph2c); 705 705 res = _FAIL; 706 706 goto exit; ··· 762 762 RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); 763 763 764 764 pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 765 - if (pcmd == NULL) { 765 + if (!pcmd) { 766 766 res = _FAIL; 767 767 goto exit; 768 768 } ··· 787 787 u8 res = _SUCCESS; 788 788 789 789 pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 790 - if (pcmd == NULL) { 790 + if (!pcmd) { 791 791 res = _FAIL; 792 792 goto exit; 793 793 } ··· 831 831 } 832 832 833 833 pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 834 - if (pcmd == NULL) { 834 + if (!pcmd) { 835 835 res = _FAIL; 836 836 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); 837 837 goto exit; ··· 856 856 } 857 857 858 858 psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; 859 - if (psecnetwork == NULL) { 860 - if (pcmd != NULL) 859 + if (!psecnetwork) { 860 + if (pcmd) 861 861 kfree(pcmd); 862 862 863 863 res = _FAIL; ··· 954 954 955 955 /* prepare cmd parameter */ 956 956 param = kzalloc(sizeof(*param), GFP_ATOMIC); 957 - if (param == NULL) { 957 + if (!param) { 958 958 res = _FAIL; 959 959 goto exit; 960 960 } ··· 963 963 if (enqueue) { 964 964 /* need enqueue, prepare cmd_obj and enqueue */ 965 965 cmdobj = kzalloc(sizeof(*cmdobj), GFP_ATOMIC); 966 - if (cmdobj == NULL) { 966 + if (!cmdobj) { 967 967 res = _FAIL; 968 968 kfree(param); 969 969 goto exit; ··· 991 991 u8 res = _SUCCESS; 992 992 993 993 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 994 - if (ph2c == NULL) { 994 + if (!ph2c) { 995 995 res = false; 996 996 goto exit; 997 997 } 998 998 psetop = kzalloc(sizeof(struct setopmode_parm), GFP_KERNEL); 999 999 1000 - if (psetop == NULL) { 1000 + if (!psetop) { 1001 1001 kfree(ph2c); 1002 1002 res = false; 1003 1003 goto exit; ··· 1026 1026 u8 res = _SUCCESS; 1027 1027 1028 1028 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 1029 - if (ph2c == NULL) { 1029 + if (!ph2c) { 1030 1030 res = _FAIL; 1031 1031 goto exit; 1032 1032 } 1033 1033 1034 1034 psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), GFP_KERNEL); 1035 - if (psetstakey_para == NULL) { 1035 + if (!psetstakey_para) { 1036 1036 kfree(ph2c); 1037 1037 res = _FAIL; 1038 1038 goto exit; 1039 1039 } 1040 1040 1041 1041 psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp), GFP_KERNEL); 1042 - if (psetstakey_rsp == NULL) { 1042 + if (!psetstakey_rsp) { 1043 1043 kfree(ph2c); 1044 1044 kfree(psetstakey_para); 1045 1045 res = _FAIL; ··· 1085 1085 clear_cam_entry(padapter, entry); 1086 1086 } else { 1087 1087 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1088 - if (ph2c == NULL) { 1088 + if (!ph2c) { 1089 1089 res = _FAIL; 1090 1090 goto exit; 1091 1091 } 1092 1092 1093 1093 psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), 1094 1094 GFP_ATOMIC); 1095 - if (psetstakey_para == NULL) { 1095 + if (!psetstakey_para) { 1096 1096 kfree(ph2c); 1097 1097 res = _FAIL; 1098 1098 goto exit; ··· 1100 1100 1101 1101 psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp), 1102 1102 GFP_ATOMIC); 1103 - if (psetstakey_rsp == NULL) { 1103 + if (!psetstakey_rsp) { 1104 1104 kfree(ph2c); 1105 1105 kfree(psetstakey_para); 1106 1106 res = _FAIL; ··· 1132 1132 u8 res = _SUCCESS; 1133 1133 1134 1134 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 1135 - if (ph2c == NULL) { 1135 + if (!ph2c) { 1136 1136 res = _FAIL; 1137 1137 goto exit; 1138 1138 } 1139 1139 psetrttblparm = kzalloc(sizeof(struct setratable_parm), GFP_KERNEL); 1140 1140 1141 - if (psetrttblparm == NULL) { 1141 + if (!psetrttblparm) { 1142 1142 kfree(ph2c); 1143 1143 res = _FAIL; 1144 1144 goto exit; ··· 1162 1162 u8 res = _SUCCESS; 1163 1163 1164 1164 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 1165 - if (ph2c == NULL) { 1165 + if (!ph2c) { 1166 1166 res = _FAIL; 1167 1167 goto exit; 1168 1168 } 1169 1169 pgetrttblparm = kzalloc(sizeof(struct getratable_parm), GFP_KERNEL); 1170 1170 1171 - if (pgetrttblparm == NULL) { 1171 + if (!pgetrttblparm) { 1172 1172 kfree(ph2c); 1173 1173 res = _FAIL; 1174 1174 goto exit; ··· 1201 1201 u8 res = _SUCCESS; 1202 1202 1203 1203 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1204 - if (ph2c == NULL) { 1204 + if (!ph2c) { 1205 1205 res = _FAIL; 1206 1206 goto exit; 1207 1207 } 1208 1208 1209 1209 psetassocsta_para = kzalloc(sizeof(struct set_assocsta_parm), GFP_ATOMIC); 1210 - if (psetassocsta_para == NULL) { 1210 + if (!psetassocsta_para) { 1211 1211 kfree(ph2c); 1212 1212 res = _FAIL; 1213 1213 goto exit; 1214 1214 } 1215 1215 1216 1216 psetassocsta_rsp = kzalloc(sizeof(struct set_assocsta_rsp), GFP_ATOMIC); 1217 - if (psetassocsta_rsp == NULL) { 1217 + if (!psetassocsta_rsp) { 1218 1218 kfree(ph2c); 1219 1219 kfree(psetassocsta_para); 1220 1220 return _FAIL; ··· 1241 1241 u8 res = _SUCCESS; 1242 1242 1243 1243 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1244 - if (ph2c == NULL) { 1244 + if (!ph2c) { 1245 1245 res = _FAIL; 1246 1246 goto exit; 1247 1247 } 1248 1248 1249 1249 paddbareq_parm = kzalloc(sizeof(struct addBaReq_parm), GFP_ATOMIC); 1250 - if (paddbareq_parm == NULL) { 1250 + if (!paddbareq_parm) { 1251 1251 kfree(ph2c); 1252 1252 res = _FAIL; 1253 1253 goto exit; ··· 1276 1276 u8 res = _SUCCESS; 1277 1277 1278 1278 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1279 - if (ph2c == NULL) { 1279 + if (!ph2c) { 1280 1280 res = _FAIL; 1281 1281 goto exit; 1282 1282 } 1283 1283 1284 1284 pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 1285 - if (pdrvextra_cmd_parm == NULL) { 1285 + if (!pdrvextra_cmd_parm) { 1286 1286 kfree(ph2c); 1287 1287 res = _FAIL; 1288 1288 goto exit; ··· 1316 1316 1317 1317 /* prepare cmd parameter */ 1318 1318 set_ch_parm = kzalloc(sizeof(*set_ch_parm), GFP_ATOMIC); 1319 - if (set_ch_parm == NULL) { 1319 + if (!set_ch_parm) { 1320 1320 res = _FAIL; 1321 1321 goto exit; 1322 1322 } ··· 1327 1327 if (enqueue) { 1328 1328 /* need enqueue, prepare cmd_obj and enqueue */ 1329 1329 pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1330 - if (pcmdobj == NULL) { 1330 + if (!pcmdobj) { 1331 1331 kfree(set_ch_parm); 1332 1332 res = _FAIL; 1333 1333 goto exit; ··· 1371 1371 /* prepare cmd parameter */ 1372 1372 setChannelPlan_param = kzalloc(sizeof(struct SetChannelPlan_param), 1373 1373 GFP_KERNEL); 1374 - if (setChannelPlan_param == NULL) { 1374 + if (!setChannelPlan_param) { 1375 1375 res = _FAIL; 1376 1376 goto exit; 1377 1377 } ··· 1380 1380 if (enqueue) { 1381 1381 /* need enqueue, prepare cmd_obj and enqueue */ 1382 1382 pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 1383 - if (pcmdobj == NULL) { 1383 + if (!pcmdobj) { 1384 1384 kfree(setChannelPlan_param); 1385 1385 res = _FAIL; 1386 1386 goto exit; ··· 1416 1416 RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_led_blink_cmd\n")); 1417 1417 1418 1418 pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1419 - if (pcmdobj == NULL) { 1419 + if (!pcmdobj) { 1420 1420 res = _FAIL; 1421 1421 goto exit; 1422 1422 } 1423 1423 1424 1424 ledBlink_param = kzalloc(sizeof(struct LedBlink_param), GFP_ATOMIC); 1425 - if (ledBlink_param == NULL) { 1425 + if (!ledBlink_param) { 1426 1426 kfree(pcmdobj); 1427 1427 res = _FAIL; 1428 1428 goto exit; ··· 1449 1449 RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_csa_cmd\n")); 1450 1450 1451 1451 pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1452 - if (pcmdobj == NULL) { 1452 + if (!pcmdobj) { 1453 1453 res = _FAIL; 1454 1454 goto exit; 1455 1455 } 1456 1456 1457 1457 setChannelSwitch_param = kzalloc(sizeof(struct SetChannelSwitch_param), 1458 1458 GFP_ATOMIC); 1459 - if (setChannelSwitch_param == NULL) { 1459 + if (!setChannelSwitch_param) { 1460 1460 kfree(pcmdobj); 1461 1461 res = _FAIL; 1462 1462 goto exit; ··· 1614 1614 1615 1615 if (enqueue) { 1616 1616 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1617 - if (ph2c == NULL) { 1617 + if (!ph2c) { 1618 1618 res = _FAIL; 1619 1619 goto exit; 1620 1620 } 1621 1621 1622 1622 pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), 1623 1623 GFP_ATOMIC); 1624 - if (pdrvextra_cmd_parm == NULL) { 1624 + if (!pdrvextra_cmd_parm) { 1625 1625 kfree(ph2c); 1626 1626 res = _FAIL; 1627 1627 goto exit; ··· 1657 1657 u8 res = _SUCCESS; 1658 1658 1659 1659 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1660 - if (ph2c == NULL) { 1660 + if (!ph2c) { 1661 1661 res = _FAIL; 1662 1662 goto exit; 1663 1663 } 1664 1664 1665 1665 pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), 1666 1666 GFP_ATOMIC); 1667 - if (pdrvextra_cmd_parm == NULL) { 1667 + if (!pdrvextra_cmd_parm) { 1668 1668 kfree(ph2c); 1669 1669 res = _FAIL; 1670 1670 goto exit; ··· 1699 1699 1700 1700 if (enqueue) { 1701 1701 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 1702 - if (ph2c == NULL) { 1702 + if (!ph2c) { 1703 1703 res = _FAIL; 1704 1704 goto exit; 1705 1705 } 1706 1706 1707 1707 pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), 1708 1708 GFP_KERNEL); 1709 - if (pdrvextra_cmd_parm == NULL) { 1709 + if (!pdrvextra_cmd_parm) { 1710 1710 kfree(ph2c); 1711 1711 res = _FAIL; 1712 1712 goto exit; ··· 1744 1744 return res; 1745 1745 1746 1746 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1747 - if (ph2c == NULL) { 1747 + if (!ph2c) { 1748 1748 res = _FAIL; 1749 1749 goto exit; 1750 1750 } 1751 1751 1752 1752 pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 1753 - if (pdrvextra_cmd_parm == NULL) { 1753 + if (!pdrvextra_cmd_parm) { 1754 1754 kfree(ph2c); 1755 1755 res = _FAIL; 1756 1756 goto exit; ··· 1779 1779 u8 res = _SUCCESS; 1780 1780 1781 1781 ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1782 - if (ppscmd == NULL) { 1782 + if (!ppscmd) { 1783 1783 res = _FAIL; 1784 1784 goto exit; 1785 1785 } 1786 1786 1787 1787 pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 1788 - if (pdrvextra_cmd_parm == NULL) { 1788 + if (!pdrvextra_cmd_parm) { 1789 1789 kfree(ppscmd); 1790 1790 res = _FAIL; 1791 1791 goto exit; ··· 1852 1852 u8 res = _SUCCESS; 1853 1853 1854 1854 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1855 - if (ph2c == NULL) { 1855 + if (!ph2c) { 1856 1856 res = _FAIL; 1857 1857 goto exit; 1858 1858 } 1859 1859 1860 1860 pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 1861 - if (pdrvextra_cmd_parm == NULL) { 1861 + if (!pdrvextra_cmd_parm) { 1862 1862 kfree(ph2c); 1863 1863 res = _FAIL; 1864 1864 goto exit; ··· 1884 1884 u8 res = _SUCCESS; 1885 1885 1886 1886 ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1887 - if (ph2c == NULL) { 1887 + if (!ph2c) { 1888 1888 res = _FAIL; 1889 1889 goto exit; 1890 1890 } 1891 1891 1892 1892 pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 1893 - if (pdrvextra_cmd_parm == NULL) { 1893 + if (!pdrvextra_cmd_parm) { 1894 1894 kfree(ph2c); 1895 1895 res = _FAIL; 1896 1896 goto exit; ··· 2103 2103 psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->MacAddress); 2104 2104 if (!psta) { 2105 2105 psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress); 2106 - if (psta == NULL) { 2106 + if (!psta) { 2107 2107 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nCan't alloc sta_info when createbss_cmd_callback\n")); 2108 2108 goto createbss_cmd_fail ; 2109 2109 } ··· 2114 2114 2115 2115 pwlan = _rtw_alloc_network(pmlmepriv); 2116 2116 spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); 2117 - if (pwlan == NULL) { 2117 + if (!pwlan) { 2118 2118 pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue); 2119 - if (pwlan == NULL) { 2119 + if (!pwlan) { 2120 2120 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n Error: can't get pwlan in rtw_joinbss_event_callback\n")); 2121 2121 spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); 2122 2122 goto createbss_cmd_fail; ··· 2151 2151 struct set_stakey_rsp *psetstakey_rsp = (struct set_stakey_rsp *)(pcmd->rsp); 2152 2152 struct sta_info *psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr); 2153 2153 2154 - if (psta == NULL) { 2154 + if (!psta) { 2155 2155 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info\n\n")); 2156 2156 goto exit; 2157 2157 } ··· 2168 2168 struct set_assocsta_rsp *passocsta_rsp = (struct set_assocsta_rsp *)(pcmd->rsp); 2169 2169 struct sta_info *psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr); 2170 2170 2171 - if (psta == NULL) { 2171 + if (!psta) { 2172 2172 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: setassocsta_cmdrsp_callbac => can't get sta_info\n\n")); 2173 2173 goto exit; 2174 2174 }
+2 -2
drivers/staging/r8188eu/core/rtw_efuse.c
··· 534 534 return _FAIL; 535 535 536 536 map = rtw_zmalloc(mapLen); 537 - if (map == NULL) 537 + if (!map) 538 538 return _FAIL; 539 539 540 540 ret = rtw_efuse_map_read(padapter, 0, mapLen, map); ··· 626 626 return _FAIL; 627 627 628 628 map = rtw_zmalloc(mapLen); 629 - if (map == NULL) 629 + if (!map) 630 630 return _FAIL; 631 631 632 632 ret = rtw_BT_efuse_map_read(padapter, 0, mapLen, map);
+5 -5
drivers/staging/r8188eu/core/rtw_ieee80211.c
··· 705 705 u8 match = false; 706 706 u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04}; 707 707 708 - if (ie_ptr == NULL) 708 + if (!ie_ptr) 709 709 return match; 710 710 711 711 eid = ie_ptr[0]; ··· 1075 1075 void rtw_macaddr_cfg(u8 *mac_addr) 1076 1076 { 1077 1077 u8 mac[ETH_ALEN]; 1078 - if (mac_addr == NULL) 1078 + if (!mac_addr) 1079 1079 return; 1080 1080 1081 1081 if (rtw_initmac) { /* Users specify the mac address */ ··· 1183 1183 u8 *p2p_ie_ptr; 1184 1184 u8 eid, p2p_oui[4] = {0x50, 0x6F, 0x9A, 0x09}; 1185 1185 1186 - if (p2p_ielen != NULL) 1186 + if (p2p_ielen) 1187 1187 *p2p_ielen = 0; 1188 1188 1189 1189 while (cnt < in_len) { ··· 1195 1195 if ((eid == _VENDOR_SPECIFIC_IE_) && !memcmp(&in_ie[cnt+2], p2p_oui, 4)) { 1196 1196 p2p_ie_ptr = in_ie + cnt; 1197 1197 1198 - if (p2p_ie != NULL) 1198 + if (p2p_ie) 1199 1199 memcpy(p2p_ie, &in_ie[cnt], in_ie[cnt + 1] + 2); 1200 - if (p2p_ielen != NULL) 1200 + if (p2p_ielen) 1201 1201 *p2p_ielen = in_ie[cnt + 1] + 2; 1202 1202 return p2p_ie_ptr; 1203 1203 } else {
+1 -1
drivers/staging/r8188eu/core/rtw_io.c
··· 294 294 struct io_priv *piopriv = &padapter->iopriv; 295 295 struct intf_hdl *pintf = &piopriv->intf; 296 296 297 - if (set_intf_ops == NULL) 297 + if (!set_intf_ops) 298 298 return _FAIL; 299 299 300 300 piopriv->padapter = padapter;
+5 -5
drivers/staging/r8188eu/core/rtw_ioctl_set.c
··· 435 435 436 436 RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("+rtw_set_802_11_bssid_list_scan(), fw_state =%x\n", get_fwstate(pmlmepriv))); 437 437 438 - if (padapter == NULL) { 438 + if (!padapter) { 439 439 res = false; 440 440 goto exit; 441 441 } ··· 568 568 { 569 569 u8 ret = _SUCCESS; 570 570 571 - if (keyindex >= 0x80000000 || padapter == NULL) { 571 + if (keyindex >= 0x80000000 || !padapter) { 572 572 ret = false; 573 573 goto exit; 574 574 } else { ··· 622 622 pbssid = get_bssid(&padapter->mlmepriv); 623 623 stainfo = rtw_get_stainfo(&padapter->stapriv, pbssid); 624 624 625 - if ((stainfo != NULL) && (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)) { 625 + if (stainfo && padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { 626 626 RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, 627 627 ("OID_802_11_ADD_KEY:(stainfo!=NULL)&&(Adapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X)\n")); 628 628 encryptionalgo = stainfo->dot118021XPrivacy; ··· 641 641 ("rtw_set_802_11_add_key: (Adapter->securitypriv.dot11AuthAlgrthm==%d)!\n", 642 642 padapter->securitypriv.dot11AuthAlgrthm)); 643 643 644 - if ((stainfo != NULL)) 644 + if (stainfo) 645 645 RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, 646 646 ("rtw_set_802_11_add_key: (stainfo->dot118021XPrivacy==%d)!\n", 647 647 stainfo->dot118021XPrivacy)); ··· 898 898 pbssid = get_bssid(&padapter->mlmepriv); 899 899 stainfo = rtw_get_stainfo(&padapter->stapriv, pbssid); 900 900 901 - if (stainfo != NULL) { 901 + if (stainfo) { 902 902 memset(&stainfo->dot118021x_UncstKey, 0, 16);/* clear keybuffer */ 903 903 904 904 memcpy(&stainfo->dot118021x_UncstKey, key->KeyMaterial, 16);
+2 -2
drivers/staging/r8188eu/core/rtw_iol.c
··· 11 11 struct xmit_priv *pxmitpriv = &(adapter->xmitpriv); 12 12 13 13 xmit_frame = rtw_alloc_xmitframe(pxmitpriv); 14 - if (xmit_frame == NULL) { 14 + if (!xmit_frame) { 15 15 DBG_88E("%s rtw_alloc_xmitframe return null\n", __func__); 16 16 goto exit; 17 17 } 18 18 19 19 xmitbuf = rtw_alloc_xmitbuf(pxmitpriv); 20 - if (xmitbuf == NULL) { 20 + if (!xmitbuf) { 21 21 DBG_88E("%s rtw_alloc_xmitbuf return null\n", __func__); 22 22 rtw_free_xmitframe(pxmitpriv, xmit_frame); 23 23 xmit_frame = NULL;
+22 -22
drivers/staging/r8188eu/core/rtw_mlme.c
··· 58 58 59 59 pbuf = rtw_zvmalloc(MAX_BSS_CNT * (sizeof(struct wlan_network))); 60 60 61 - if (pbuf == NULL) { 61 + if (!pbuf) { 62 62 res = _FAIL; 63 63 goto exit; 64 64 } ··· 139 139 int _rtw_enqueue_network(struct __queue *queue, struct wlan_network *pnetwork) 140 140 { 141 141 142 - if (pnetwork == NULL) 142 + if (!pnetwork) 143 143 goto exit; 144 144 145 145 spin_lock_bh(&queue->lock); ··· 211 211 u32 lifetime = SCANQUEUE_LIFETIME; 212 212 struct __queue *free_queue = &(pmlmepriv->free_bss_pool); 213 213 214 - if (pnetwork == NULL) 214 + if (!pnetwork) 215 215 return; 216 216 217 217 if (pnetwork->fixed) ··· 236 236 { 237 237 struct __queue *free_queue = &(pmlmepriv->free_bss_pool); 238 238 239 - if (pnetwork == NULL) 239 + if (!pnetwork) 240 240 return; 241 241 if (pnetwork->fixed) 242 242 return; ··· 466 466 pwlan = container_of(plist, struct wlan_network, list); 467 467 468 468 if (!pwlan->fixed) { 469 - if (oldest == NULL || time_after(oldest->last_scanned, pwlan->last_scanned)) 469 + if (!oldest || time_after(oldest->last_scanned, pwlan->last_scanned)) 470 470 oldest = pwlan; 471 471 } 472 472 ··· 584 584 585 585 pnetwork = rtw_alloc_network(pmlmepriv); /* will update scan_time */ 586 586 587 - if (pnetwork == NULL) { 587 + if (!pnetwork) { 588 588 RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("\n\n\nsomething wrong here\n\n\n")); 589 589 goto exit; 590 590 } ··· 659 659 privacy = pnetwork->network.Privacy; 660 660 661 661 if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { 662 - if (rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen) != NULL) 662 + if (rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen)) 663 663 return true; 664 664 else 665 665 return false; ··· 1035 1035 struct sta_priv *pstapriv = &padapter->stapriv; 1036 1036 1037 1037 psta = rtw_get_stainfo(pstapriv, pnetwork->network.MacAddress); 1038 - if (psta == NULL) 1038 + if (!psta) 1039 1039 psta = rtw_alloc_stainfo(pstapriv, pnetwork->network.MacAddress); 1040 1040 1041 1041 if (psta) { /* update ptarget_sta */ ··· 1227 1227 /* s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode */ 1228 1228 if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { 1229 1229 ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork); 1230 - if (ptarget_sta == NULL) { 1230 + if (!ptarget_sta) { 1231 1231 RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("Can't update stainfo when joinbss_event callback\n")); 1232 1232 spin_unlock_bh(&pmlmepriv->scanned_queue.lock); 1233 1233 goto ignore_joinbss_callback; ··· 1297 1297 #if defined (CONFIG_88EU_AP_MODE) 1298 1298 if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { 1299 1299 for (aid = (pstapriv->max_num_sta); aid > 0; aid--) { 1300 - if (pstapriv->sta_aid[aid-1] != NULL) 1300 + if (pstapriv->sta_aid[aid-1]) 1301 1301 break; 1302 1302 } 1303 1303 mac_id = aid + 1; ··· 1319 1319 u16 media_status_rpt; 1320 1320 u8 macid; 1321 1321 1322 - if (psta == NULL) 1322 + if (!psta) 1323 1323 return; 1324 1324 1325 1325 macid = search_max_mac_id(adapter); ··· 1351 1351 #endif 1352 1352 /* for AD-HOC mode */ 1353 1353 psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); 1354 - if (psta != NULL) { 1354 + if (psta) { 1355 1355 /* the sta have been in sta_info_queue => do nothing */ 1356 1356 RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("Error: rtw_stassoc_event_callback: sta has been in sta_hash_queue\n")); 1357 1357 return; /* between drv has received this event before and fw have not yet to set key to CAM_ENTRY) */ 1358 1358 } 1359 1359 psta = rtw_alloc_stainfo(&adapter->stapriv, pstassoc->macaddr); 1360 - if (psta == NULL) { 1360 + if (!psta) { 1361 1361 RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("Can't alloc sta_info when rtw_stassoc_event_callback\n")); 1362 1362 return; 1363 1363 } ··· 1653 1653 goto exit; 1654 1654 } 1655 1655 1656 - if (*candidate == NULL || (*candidate)->network.Rssi < competitor->network.Rssi) { 1656 + if (!*candidate || (*candidate)->network.Rssi < competitor->network.Rssi) { 1657 1657 *candidate = competitor; 1658 1658 updated = true; 1659 1659 } ··· 1694 1694 pmlmepriv->pscanned = phead->next; 1695 1695 while (phead != pmlmepriv->pscanned) { 1696 1696 pnetwork = container_of(pmlmepriv->pscanned, struct wlan_network, list); 1697 - if (pnetwork == NULL) { 1697 + if (!pnetwork) { 1698 1698 RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("%s return _FAIL:(pnetwork==NULL)\n", __func__)); 1699 1699 ret = _FAIL; 1700 1700 goto exit; ··· 1702 1702 pmlmepriv->pscanned = pmlmepriv->pscanned->next; 1703 1703 rtw_check_join_candidate(pmlmepriv, &candidate, pnetwork); 1704 1704 } 1705 - if (candidate == NULL) { 1705 + if (!candidate) { 1706 1706 DBG_88E("%s: return _FAIL(candidate==NULL)\n", __func__); 1707 1707 ret = _FAIL; 1708 1708 goto exit; ··· 1747 1747 int res = _SUCCESS; 1748 1748 1749 1749 pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 1750 - if (pcmd == NULL) { 1750 + if (!pcmd) { 1751 1751 res = _FAIL; /* try again */ 1752 1752 goto exit; 1753 1753 } 1754 1754 1755 1755 psetauthparm = (struct setauth_parm *)rtw_zmalloc(sizeof(struct setauth_parm)); 1756 - if (psetauthparm == NULL) { 1756 + if (!psetauthparm) { 1757 1757 kfree(pcmd); 1758 1758 res = _FAIL; 1759 1759 goto exit; ··· 1785 1785 int res = _SUCCESS; 1786 1786 1787 1787 pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 1788 - if (pcmd == NULL) { 1788 + if (!pcmd) { 1789 1789 res = _FAIL; /* try again */ 1790 1790 goto exit; 1791 1791 } 1792 1792 psetkeyparm = (struct setkey_parm *)rtw_zmalloc(sizeof(struct setkey_parm)); 1793 - if (psetkeyparm == NULL) { 1793 + if (!psetkeyparm) { 1794 1794 kfree(pcmd); 1795 1795 res = _FAIL; 1796 1796 goto exit; ··· 2272 2272 else 2273 2273 psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); 2274 2274 2275 - if (psta == NULL) 2275 + if (!psta) 2276 2276 return; 2277 2277 2278 2278 phtpriv = &psta->htpriv; ··· 2304 2304 2305 2305 struct wlan_network *pnetwork; 2306 2306 2307 - if (tgt_network != NULL) 2307 + if (tgt_network) 2308 2308 pnetwork = tgt_network; 2309 2309 else 2310 2310 pnetwork = &pmlmepriv->cur_network;
+67 -67
drivers/staging/r8188eu/core/rtw_mlme_ext.c
··· 289 289 ((BW40MINUS == o->bw) || (BW40PLUS == o->bw))) 290 290 continue; 291 291 292 - if (reg == NULL) { 292 + if (!reg) { 293 293 reg = &channel_list->reg_class[cla]; 294 294 cla++; 295 295 reg->reg_class = o->op_class; ··· 442 442 } 443 443 ptable += index; 444 444 445 - if (psta != NULL) { 445 + if (psta) { 446 446 if (GetRetry(pframe)) { 447 447 if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum) { 448 448 /* drop the duplicate management frame */ ··· 570 570 len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_); 571 571 572 572 /* check (wildcard) SSID */ 573 - if (p != NULL) { 573 + if (p) { 574 574 if (is_valid_p2p_probereq) 575 575 goto _issue_probersp; 576 576 ··· 685 685 686 686 if (((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) && (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) { 687 687 psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); 688 - if (psta != NULL) { 688 + if (psta) { 689 689 ret = rtw_check_bcn_info(padapter, pframe, len); 690 690 if (!ret) { 691 691 DBG_88E_LEVEL(_drv_info_, "ap has changed, disconnect now\n "); ··· 700 700 } 701 701 } else if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { 702 702 psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); 703 - if (psta != NULL) { 703 + if (psta) { 704 704 /* update WMM, ERP in the beacon */ 705 705 /* todo: the timer is used instead of the number of the beacon received */ 706 706 if ((sta_rx_pkts(psta) & 0xf) == 0) ··· 781 781 } 782 782 783 783 pstat = rtw_get_stainfo(pstapriv, sa); 784 - if (pstat == NULL) { 784 + if (!pstat) { 785 785 /* allocate a new one */ 786 786 DBG_88E("going to alloc stainfo for sa=%pM\n", sa); 787 787 pstat = rtw_alloc_stainfo(pstapriv, sa); 788 - if (pstat == NULL) { 788 + if (!pstat) { 789 789 DBG_88E(" Exceed the upper limit of supported clients...\n"); 790 790 status = _STATS_UNABLE_HANDLE_STA_; 791 791 goto auth_fail; ··· 850 850 p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&ie_len, 851 851 len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4); 852 852 853 - if ((p == NULL) || (ie_len <= 0)) { 853 + if (!p || ie_len <= 0) { 854 854 DBG_88E("auth rejected because challenge failure!(1)\n"); 855 855 status = _STATS_CHALLENGE_FAIL_; 856 856 goto auth_fail; ··· 947 947 p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&len, 948 948 pkt_len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_); 949 949 950 - if (p == NULL) 950 + if (!p) 951 951 goto authclnt_fail; 952 952 953 953 memcpy((void *)(pmlmeinfo->chg_txt), (void *)(p + 2), len); ··· 1065 1065 /* checking SSID */ 1066 1066 p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _SSID_IE_, &ie_len, 1067 1067 pkt_len - WLAN_HDR_A3_LEN - ie_offset); 1068 - if (p == NULL) 1068 + if (!p) 1069 1069 status = _STATS_FAILURE_; 1070 1070 1071 1071 if (ie_len == 0) { /* broadcast ssid, however it is not allowed in assocreq */ ··· 1084 1084 1085 1085 /* check if the supported rate is ok */ 1086 1086 p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _SUPPORTEDRATES_IE_, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset); 1087 - if (p == NULL) { 1087 + if (!p) { 1088 1088 DBG_88E("Rx a sta assoc-req which supported rate is empty!\n"); 1089 1089 /* use our own rate set as statoin used */ 1090 1090 /* memcpy(supportRate, AP_BSSRATE, AP_BSSRATE_LEN); */ ··· 1098 1098 1099 1099 p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _EXT_SUPPORTEDRATES_IE_, &ie_len, 1100 1100 pkt_len - WLAN_HDR_A3_LEN - ie_offset); 1101 - if (p != NULL) { 1101 + if (p) { 1102 1102 if (supportRateNum <= sizeof(supportRate)) { 1103 1103 memcpy(supportRate+supportRateNum, p+2, ie_len); 1104 1104 supportRateNum += ie_len; ··· 1173 1173 goto OnAssocReqFail; 1174 1174 1175 1175 pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS); 1176 - if (wpa_ie == NULL) { 1176 + if (!wpa_ie) { 1177 1177 if (elems.wps_ie) { 1178 1178 DBG_88E("STA included WPS IE in " 1179 1179 "(Re)Association Request - assume WPS is " ··· 1243 1243 p = pframe + WLAN_HDR_A3_LEN + ie_offset; ie_len = 0; 1244 1244 for (;;) { 1245 1245 p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset); 1246 - if (p != NULL) { 1246 + if (p) { 1247 1247 if (!memcmp(p+2, WMM_IE, 6)) { 1248 1248 pstat->flags |= WLAN_STA_WME; 1249 1249 ··· 1357 1357 DBG_88E(" old AID %d\n", pstat->aid); 1358 1358 } else { 1359 1359 for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++) 1360 - if (pstapriv->sta_aid[pstat->aid - 1] == NULL) 1360 + if (!pstapriv->sta_aid[pstat->aid - 1]) 1361 1361 break; 1362 1362 1363 1363 /* if (pstat->aid > NUM_STA) { */ ··· 1751 1751 addr = GetAddr2Ptr(pframe); 1752 1752 psta = rtw_get_stainfo(pstapriv, addr); 1753 1753 1754 - if (psta == NULL) 1754 + if (!psta) 1755 1755 return _SUCCESS; 1756 1756 1757 1757 frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); ··· 1837 1837 struct wifidirect_info *pwdinfo = &(padapter->wdinfo); 1838 1838 1839 1839 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 1840 - if (pmgntframe == NULL) 1840 + if (!pmgntframe) 1841 1841 return; 1842 1842 1843 1843 DBG_88E("[%s] In\n", __func__); ··· 2175 2175 struct wifidirect_info *pwdinfo = &(padapter->wdinfo); 2176 2176 2177 2177 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 2178 - if (pmgntframe == NULL) 2178 + if (!pmgntframe) 2179 2179 return; 2180 2180 2181 2181 DBG_88E("[%s] In, result=%d\n", __func__, result); ··· 2534 2534 struct wifidirect_info *pwdinfo = &(padapter->wdinfo); 2535 2535 2536 2536 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 2537 - if (pmgntframe == NULL) 2537 + if (!pmgntframe) 2538 2538 return; 2539 2539 2540 2540 DBG_88E("[%s] In\n", __func__); ··· 2698 2698 struct wifidirect_info *pwdinfo = &(padapter->wdinfo); 2699 2699 2700 2700 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 2701 - if (pmgntframe == NULL) 2701 + if (!pmgntframe) 2702 2702 return; 2703 2703 2704 2704 /* update attribute */ ··· 2946 2946 struct wifidirect_info *pwdinfo = &(padapter->wdinfo); 2947 2947 2948 2948 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 2949 - if (pmgntframe == NULL) 2949 + if (!pmgntframe) 2950 2950 return; 2951 2951 2952 2952 /* update attribute */ ··· 3139 3139 struct wifidirect_info *pwdinfo = &(padapter->wdinfo); 3140 3140 3141 3141 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 3142 - if (pmgntframe == NULL) 3142 + if (!pmgntframe) 3143 3143 return; 3144 3144 3145 3145 DBG_88E("[%s] In\n", __func__); ··· 3252 3252 u32 wpsielen = 0, p2pielen = 0; 3253 3253 3254 3254 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 3255 - if (pmgntframe == NULL) 3255 + if (!pmgntframe) 3256 3256 return; 3257 3257 3258 3258 /* update attribute */ ··· 3500 3500 struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); 3501 3501 3502 3502 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 3503 - if (pmgntframe == NULL) 3503 + if (!pmgntframe) 3504 3504 goto exit; 3505 3505 3506 3506 /* update attribute */ ··· 3569 3569 /* Value: */ 3570 3570 wpsie[wpsielen++] = WPS_VERSION_1; /* Version 1.0 */ 3571 3571 3572 - if (pmlmepriv->wps_probe_req_ie == NULL) { 3572 + if (!pmlmepriv->wps_probe_req_ie) { 3573 3573 /* UUID-E */ 3574 3574 /* Type: */ 3575 3575 *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_UUID_E); ··· 3747 3747 3748 3748 pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *)p2pie, &pattrib->pktlen); 3749 3749 3750 - if (pmlmepriv->wps_probe_req_ie != NULL) { 3750 + if (pmlmepriv->wps_probe_req_ie) { 3751 3751 /* WPS IE */ 3752 3752 memcpy(pframe, pmlmepriv->wps_probe_req_ie, pmlmepriv->wps_probe_req_ie_len); 3753 3753 pattrib->pktlen += pmlmepriv->wps_probe_req_ie_len; ··· 4280 4280 struct xmit_buf *pxmitbuf; 4281 4281 4282 4282 pmgntframe = rtw_alloc_xmitframe(pxmitpriv); 4283 - if (pmgntframe == NULL) { 4283 + if (!pmgntframe) { 4284 4284 DBG_88E("%s, alloc xmitframe fail\n", __func__); 4285 4285 return NULL; 4286 4286 } 4287 4287 4288 4288 pxmitbuf = rtw_alloc_xmitbuf_ext(pxmitpriv); 4289 - if (pxmitbuf == NULL) { 4289 + if (!pxmitbuf) { 4290 4290 DBG_88E("%s, alloc xmitbuf fail\n", __func__); 4291 4291 rtw_free_xmitframe(pxmitpriv, pmgntframe); 4292 4292 return NULL; ··· 4448 4448 #endif /* CONFIG_88EU_P2P */ 4449 4449 4450 4450 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 4451 - if (pmgntframe == NULL) { 4451 + if (!pmgntframe) { 4452 4452 DBG_88E("%s, alloc mgnt frame fail\n", __func__); 4453 4453 return; 4454 4454 } ··· 4677 4677 #endif /* CONFIG_88EU_P2P */ 4678 4678 4679 4679 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 4680 - if (pmgntframe == NULL) { 4680 + if (!pmgntframe) { 4681 4681 DBG_88E("%s, alloc mgnt frame fail\n", __func__); 4682 4682 return; 4683 4683 } ··· 4716 4716 pwps_ie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen); 4717 4717 4718 4718 /* inerset & update wps_probe_resp_ie */ 4719 - if ((pmlmepriv->wps_probe_resp_ie != NULL) && pwps_ie && (wps_ielen > 0)) { 4719 + if (pmlmepriv->wps_probe_resp_ie && pwps_ie && wps_ielen > 0) { 4720 4720 uint wps_offset, remainder_ielen; 4721 4721 u8 *premainder_ie; 4722 4722 ··· 4834 4834 RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+issue_probereq\n")); 4835 4835 4836 4836 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 4837 - if (pmgntframe == NULL) 4837 + if (!pmgntframe) 4838 4838 goto exit; 4839 4839 4840 4840 /* update attribute */ ··· 4970 4970 struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4971 4971 4972 4972 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 4973 - if (pmgntframe == NULL) 4973 + if (!pmgntframe) 4974 4974 return; 4975 4975 4976 4976 /* update attribute */ ··· 5109 5109 DBG_88E("%s\n", __func__); 5110 5110 5111 5111 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 5112 - if (pmgntframe == NULL) 5112 + if (!pmgntframe) 5113 5113 return; 5114 5114 5115 5115 /* update attribute */ ··· 5191 5191 break; 5192 5192 } 5193 5193 5194 - if ((pbuf == NULL) || (ie_len == 0)) 5194 + if (!pbuf || ie_len == 0) 5195 5195 break; 5196 5196 } 5197 5197 } ··· 5247 5247 #endif /* CONFIG_88EU_P2P */ 5248 5248 5249 5249 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 5250 - if (pmgntframe == NULL) 5250 + if (!pmgntframe) 5251 5251 goto exit; 5252 5252 5253 5253 /* update attribute */ ··· 5341 5341 5342 5342 /* RSN */ 5343 5343 p = rtw_get_ie((pmlmeinfo->network.IEs + sizeof(struct ndis_802_11_fixed_ie)), _RSN_IE_2_, &ie_len, (pmlmeinfo->network.IELength - sizeof(struct ndis_802_11_fixed_ie))); 5344 - if (p != NULL) 5344 + if (p) 5345 5345 pframe = rtw_set_ie(pframe, _RSN_IE_2_, ie_len, (p + 2), &(pattrib->pktlen)); 5346 5346 5347 5347 /* HT caps */ 5348 5348 if (padapter->mlmepriv.htpriv.ht_option) { 5349 5349 p = rtw_get_ie((pmlmeinfo->network.IEs + sizeof(struct ndis_802_11_fixed_ie)), _HT_CAPABILITY_IE_, &ie_len, (pmlmeinfo->network.IELength - sizeof(struct ndis_802_11_fixed_ie))); 5350 - if ((p != NULL) && (!(is_ap_in_tkip(padapter)))) { 5350 + if (p && !is_ap_in_tkip(padapter)) { 5351 5351 memcpy(&(pmlmeinfo->HT_caps), (p + 2), sizeof(struct HT_caps_element)); 5352 5352 5353 5353 /* to disable 40M Hz support while gd_bw_40MHz_en = 0 */ ··· 5576 5576 pmlmeinfo = &(pmlmeext->mlmext_info); 5577 5577 5578 5578 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 5579 - if (pmgntframe == NULL) 5579 + if (!pmgntframe) 5580 5580 goto exit; 5581 5581 5582 5582 /* update attribute */ ··· 5635 5635 struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5636 5636 5637 5637 /* da == NULL, assum it's null data for sta to ap*/ 5638 - if (da == NULL) 5638 + if (!da) 5639 5639 da = get_my_bssid(&(pmlmeinfo->network)); 5640 5640 5641 5641 do { ··· 5686 5686 DBG_88E("%s\n", __func__); 5687 5687 5688 5688 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 5689 - if (pmgntframe == NULL) 5689 + if (!pmgntframe) 5690 5690 goto exit; 5691 5691 5692 5692 /* update attribute */ ··· 5758 5758 struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5759 5759 5760 5760 /* da == NULL, assum it's null data for sta to ap*/ 5761 - if (da == NULL) 5761 + if (!da) 5762 5762 da = get_my_bssid(&(pmlmeinfo->network)); 5763 5763 5764 5764 do { ··· 5816 5816 #endif /* CONFIG_88EU_P2P */ 5817 5817 5818 5818 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 5819 - if (pmgntframe == NULL) 5819 + if (!pmgntframe) 5820 5820 goto exit; 5821 5821 5822 5822 /* update attribute */ ··· 5917 5917 FUNC_NDEV_ARG(padapter->pnetdev), ra, new_ch, ch_offset); 5918 5918 5919 5919 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 5920 - if (pmgntframe == NULL) 5920 + if (!pmgntframe) 5921 5921 return; 5922 5922 5923 5923 /* update attribute */ ··· 5987 5987 DBG_88E("%s, category=%d, action=%d, status=%d\n", __func__, category, action, status); 5988 5988 5989 5989 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 5990 - if (pmgntframe == NULL) 5990 + if (!pmgntframe) 5991 5991 return; 5992 5992 5993 5993 /* update attribute */ ··· 6034 6034 pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); 6035 6035 6036 6036 psta = rtw_get_stainfo(pstapriv, raddr); 6037 - if (psta != NULL) { 6037 + if (psta) { 6038 6038 start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07]&0xfff) + 1; 6039 6039 6040 6040 DBG_88E("BA_starting_seqctrl=%d for TID=%d\n", start_seq, status & 0x07); ··· 6126 6126 action = ACT_PUBLIC_BSSCOEXIST; 6127 6127 6128 6128 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 6129 - if (pmgntframe == NULL) 6129 + if (!pmgntframe) 6130 6130 return; 6131 6131 6132 6132 /* update attribute */ ··· 6186 6186 pbss_network = (struct wlan_bssid_ex *)&pnetwork->network; 6187 6187 6188 6188 p = rtw_get_ie(pbss_network->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pbss_network->IELength - _FIXED_IE_LENGTH_); 6189 - if ((p == NULL) || (len == 0)) { /* non-HT */ 6189 + if (!p || len == 0) { /* non-HT */ 6190 6190 if ((pbss_network->Configuration.DSConfig <= 0) || (pbss_network->Configuration.DSConfig > 14)) 6191 6191 continue; 6192 6192 ··· 6240 6240 return _SUCCESS; 6241 6241 6242 6242 psta = rtw_get_stainfo(pstapriv, addr); 6243 - if (psta == NULL) 6243 + if (!psta) 6244 6244 return _SUCCESS; 6245 6245 6246 6246 if (initiator == 0) { /* recipient */ ··· 6526 6526 6527 6527 /* checking SSID */ 6528 6528 p = rtw_get_ie(bssid->IEs + ie_offset, _SSID_IE_, &len, bssid->IELength - ie_offset); 6529 - if (p == NULL) { 6529 + if (!p) { 6530 6530 DBG_88E("marc: cannot find SSID for survey event\n"); 6531 6531 return _FAIL; 6532 6532 } ··· 6547 6547 /* checking rate info... */ 6548 6548 i = 0; 6549 6549 p = rtw_get_ie(bssid->IEs + ie_offset, _SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset); 6550 - if (p != NULL) { 6550 + if (p) { 6551 6551 if (len > NDIS_802_11_LENGTH_RATES_EX) { 6552 6552 DBG_88E("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len); 6553 6553 return _FAIL; ··· 6557 6557 } 6558 6558 6559 6559 p = rtw_get_ie(bssid->IEs + ie_offset, _EXT_SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset); 6560 - if (p != NULL) { 6560 + if (p) { 6561 6561 if (len > (NDIS_802_11_LENGTH_RATES_EX-i)) { 6562 6562 DBG_88E("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len); 6563 6563 return _FAIL; ··· 6986 6986 pcmdpriv = &padapter->cmdpriv; 6987 6987 6988 6988 pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 6989 - if (pcmd_obj == NULL) 6989 + if (!pcmd_obj) 6990 6990 return; 6991 6991 6992 6992 cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); 6993 6993 pevtcmd = (u8 *)rtw_zmalloc(cmdsz); 6994 - if (pevtcmd == NULL) { 6994 + if (!pevtcmd) { 6995 6995 kfree(pcmd_obj); 6996 6996 return; 6997 6997 } ··· 7038 7038 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 7039 7039 7040 7040 pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 7041 - if (pcmd_obj == NULL) 7041 + if (!pcmd_obj) 7042 7042 return; 7043 7043 7044 7044 cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header)); 7045 7045 pevtcmd = (u8 *)rtw_zmalloc(cmdsz); 7046 - if (pevtcmd == NULL) { 7046 + if (!pevtcmd) { 7047 7047 kfree(pcmd_obj); 7048 7048 return; 7049 7049 } ··· 7084 7084 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 7085 7085 7086 7086 pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 7087 - if (pcmd_obj == NULL) 7087 + if (!pcmd_obj) 7088 7088 return; 7089 7089 7090 7090 cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); 7091 7091 pevtcmd = (u8 *)rtw_zmalloc(cmdsz); 7092 - if (pevtcmd == NULL) { 7092 + if (!pevtcmd) { 7093 7093 kfree(pcmd_obj); 7094 7094 return; 7095 7095 } ··· 7135 7135 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 7136 7136 7137 7137 pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 7138 - if (pcmd_obj == NULL) 7138 + if (!pcmd_obj) 7139 7139 return; 7140 7140 7141 7141 cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header)); 7142 7142 pevtcmd = (u8 *)rtw_zmalloc(cmdsz); 7143 - if (pevtcmd == NULL) { 7143 + if (!pevtcmd) { 7144 7144 kfree(pcmd_obj); 7145 7145 return; 7146 7146 } ··· 7189 7189 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 7190 7190 7191 7191 pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 7192 - if (pcmd_obj == NULL) 7192 + if (!pcmd_obj) 7193 7193 return; 7194 7194 7195 7195 cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header)); 7196 7196 pevtcmd = (u8 *)rtw_zmalloc(cmdsz); 7197 - if (pevtcmd == NULL) { 7197 + if (!pevtcmd) { 7198 7198 kfree(pcmd_obj); 7199 7199 return; 7200 7200 } ··· 7479 7479 7480 7480 rx_chk_limit = 4; 7481 7481 psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress); 7482 - if (psta != NULL) { 7482 + if (psta) { 7483 7483 bool is_p2p_enable = false; 7484 7484 #ifdef CONFIG_88EU_P2P 7485 7485 is_p2p_enable = !rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE); ··· 7612 7612 } 7613 7613 7614 7614 ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 7615 - if (ph2c == NULL) 7615 + if (!ph2c) 7616 7616 goto exit_survey_timer_hdl; 7617 7617 7618 7618 psurveyPara = (struct sitesurvey_parm *)rtw_zmalloc(sizeof(struct sitesurvey_parm)); 7619 - if (psurveyPara == NULL) { 7619 + if (!psurveyPara) { 7620 7620 kfree(ph2c); 7621 7621 goto exit_survey_timer_hdl; 7622 7622 } ··· 8189 8189 int len_diff = 0; 8190 8190 8191 8191 ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 8192 - if (ph2c == NULL) { 8192 + if (!ph2c) { 8193 8193 res = _FAIL; 8194 8194 goto exit; 8195 8195 } 8196 8196 8197 8197 ptxBeacon_parm = (struct Tx_Beacon_param *)rtw_zmalloc(sizeof(struct Tx_Beacon_param)); 8198 - if (ptxBeacon_parm == NULL) { 8198 + if (!ptxBeacon_parm) { 8199 8199 kfree(ph2c); 8200 8200 res = _FAIL; 8201 8201 goto exit;
+6 -6
drivers/staging/r8188eu/core/rtw_mp.c
··· 382 382 rtw_free_stainfo(padapter, psta); 383 383 384 384 psta = rtw_alloc_stainfo(&padapter->stapriv, bssid.MacAddress); 385 - if (psta == NULL) { 385 + if (!psta) { 386 386 RT_TRACE(_module_mp_, _drv_err_, ("mp_start_test: Can't alloc sta_info!\n")); 387 387 pmlmepriv->fw_state = pmppriv->prev_fw_state; 388 388 res = _FAIL; ··· 547 547 struct xmit_buf *pxmitbuf; 548 548 549 549 pmpframe = rtw_alloc_xmitframe(pxmitpriv); 550 - if (pmpframe == NULL) 550 + if (!pmpframe) 551 551 return NULL; 552 552 553 553 pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv); 554 - if (pxmitbuf == NULL) { 554 + if (!pxmitbuf) { 555 555 rtw_free_xmitframe(pxmitpriv, pmpframe); 556 556 return NULL; 557 557 } ··· 585 585 /* DBG_88E("%s:pkTx Start\n", __func__); */ 586 586 while (1) { 587 587 pxmitframe = alloc_mp_xmitframe(pxmitpriv); 588 - if (pxmitframe == NULL) { 588 + if (!pxmitframe) { 589 589 if (pmptx->stop || 590 590 padapter->bSurpriseRemoved || 591 591 padapter->bDriverStopped) { ··· 670 670 pmp_priv->tx.write_size = pkt_size; 671 671 pmp_priv->tx.buf_size = pkt_size + XMITBUF_ALIGN_SZ; 672 672 pmp_priv->tx.pallocated_buf = rtw_zmalloc(pmp_priv->tx.buf_size); 673 - if (pmp_priv->tx.pallocated_buf == NULL) { 673 + if (!pmp_priv->tx.pallocated_buf) { 674 674 DBG_88E("%s: malloc(%d) fail!!\n", __func__, pmp_priv->tx.buf_size); 675 675 return; 676 676 } ··· 938 938 939 939 pxmitpriv->pallocated_xmit_extbuf = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_buf) + 4); 940 940 941 - if (pxmitpriv->pallocated_xmit_extbuf == NULL) { 941 + if (!pxmitpriv->pallocated_xmit_extbuf) { 942 942 RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xmit_extbuf fail!\n")); 943 943 res = _FAIL; 944 944 goto exit;
+8 -8
drivers/staging/r8188eu/core/rtw_p2p.c
··· 128 128 DBG_88E("[%s]\n", __func__); 129 129 130 130 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 131 - if (pmgntframe == NULL) 131 + if (!pmgntframe) 132 132 return; 133 133 134 134 /* update attribute */ ··· 187 187 DBG_88E("[%s]\n", __func__); 188 188 189 189 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 190 - if (pmgntframe == NULL) 190 + if (!pmgntframe) 191 191 return; 192 192 193 193 /* update attribute */ ··· 257 257 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 258 258 259 259 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 260 - if (pmgntframe == NULL) 260 + if (!pmgntframe) 261 261 return; 262 262 263 263 /* update attribute */ ··· 336 336 DBG_88E("[%s]\n", __func__); 337 337 338 338 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 339 - if (pmgntframe == NULL) 339 + if (!pmgntframe) 340 340 return; 341 341 342 342 /* update attribute */ ··· 792 792 if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE) || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { 793 793 p2pie = rtw_get_p2p_ie(pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_, NULL, &p2pielen); 794 794 if (p2pie) { 795 - if ((p != NULL) && !memcmp((void *)(p+2), (void *)pwdinfo->p2p_wildcard_ssid, 7)) { 795 + if (p && !memcmp((void *)(p+2), (void *)pwdinfo->p2p_wildcard_ssid, 7)) { 796 796 /* todo: */ 797 797 /* Check Requested Device Type attributes in WSC IE. */ 798 798 /* Check Device ID attribute in P2P IE */ 799 799 800 800 ret = true; 801 - } else if ((p != NULL) && (ssid_len == 0)) { 801 + } else if (p && ssid_len == 0) { 802 802 ret = true; 803 803 } 804 804 } else { ··· 1700 1700 1701 1701 if (enqueue) { 1702 1702 ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); 1703 - if (ph2c == NULL) { 1703 + if (!ph2c) { 1704 1704 res = _FAIL; 1705 1705 goto exit; 1706 1706 } 1707 1707 1708 1708 pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1709 - if (pdrvextra_cmd_parm == NULL) { 1709 + if (!pdrvextra_cmd_parm) { 1710 1710 kfree(ph2c); 1711 1711 res = _FAIL; 1712 1712 goto exit;
+22 -22
drivers/staging/r8188eu/core/rtw_recv.c
··· 60 60 61 61 precvpriv->pallocated_frame_buf = rtw_zvmalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ); 62 62 63 - if (precvpriv->pallocated_frame_buf == NULL) { 63 + if (!precvpriv->pallocated_frame_buf) { 64 64 res = _FAIL; 65 65 goto exit; 66 66 } ··· 141 141 142 142 list_del_init(&hdr->list); 143 143 padapter = hdr->adapter; 144 - if (padapter != NULL) { 144 + if (padapter) { 145 145 precvpriv = &padapter->recvpriv; 146 146 if (pfree_recv_queue == &precvpriv->free_recv_queue) 147 147 precvpriv->free_recvframe_cnt--; ··· 194 194 195 195 list_add_tail(&(precvframe->list), get_list_head(pfree_recv_queue)); 196 196 197 - if (padapter != NULL) { 197 + if (padapter) { 198 198 if (pfree_recv_queue == &precvpriv->free_recv_queue) 199 199 precvpriv->free_recvframe_cnt++; 200 200 } ··· 212 212 list_del_init(&(precvframe->list)); 213 213 list_add_tail(&(precvframe->list), get_list_head(queue)); 214 214 215 - if (padapter != NULL) { 215 + if (padapter) { 216 216 if (queue == &precvpriv->free_recv_queue) 217 217 precvpriv->free_recvframe_cnt++; 218 218 } ··· 347 347 prxattrib->ra[0], prxattrib->ra[1], prxattrib->ra[2], prxattrib->ra[3], prxattrib->ra[4], prxattrib->ra[5])); 348 348 349 349 /* calculate mic code */ 350 - if (stainfo != NULL) { 350 + if (stainfo) { 351 351 if (IS_MCAST(prxattrib->ra)) { 352 352 mickey = &psecuritypriv->dot118021XGrprxmickey[prxattrib->key_index].skey[0]; 353 353 ··· 541 541 adapter->securitypriv.dot11AuthAlgrthm)); 542 542 543 543 if (auth_alg == 2) { 544 - if ((psta != NULL) && (psta->ieee8021x_blocked)) { 544 + if (psta && psta->ieee8021x_blocked) { 545 545 /* blocked */ 546 546 /* only accept EAPOL frame */ 547 547 RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:psta->ieee8021x_blocked==1\n")); ··· 805 805 else 806 806 *psta = rtw_get_stainfo(pstapriv, sta_addr); /* get ap_info */ 807 807 808 - if (*psta == NULL) { 808 + if (!*psta) { 809 809 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under sta2sta_data_frame ; drop pkt\n")); 810 810 if (adapter->registrypriv.mp_mode == 1) { 811 811 if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) ··· 874 874 else 875 875 *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get ap_info */ 876 876 877 - if (*psta == NULL) { 877 + if (!*psta) { 878 878 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("ap2sta: can't get psta under STATION_MODE ; drop pkt\n")); 879 879 ret = _FAIL; 880 880 goto exit; ··· 901 901 memcpy(pattrib->bssid, mybssid, ETH_ALEN); 902 902 903 903 *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ 904 - if (*psta == NULL) { 904 + if (!*psta) { 905 905 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under MP_MODE ; drop pkt\n")); 906 906 ret = _FAIL; 907 907 goto exit; ··· 913 913 } else { 914 914 if (!memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && (!bmcast)) { 915 915 *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ 916 - if (*psta == NULL) { 916 + if (!*psta) { 917 917 DBG_88E("issue_deauth to the ap =%pM for the reason(7)\n", (pattrib->bssid)); 918 918 919 919 issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); ··· 947 947 } 948 948 949 949 *psta = rtw_get_stainfo(pstapriv, pattrib->src); 950 - if (*psta == NULL) { 950 + if (!*psta) { 951 951 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under AP_MODE; drop pkt\n")); 952 952 DBG_88E("issue_deauth to sta=%pM for the reason(7)\n", (pattrib->src)); 953 953 ··· 1011 1011 aid = GetAid(pframe); 1012 1012 psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); 1013 1013 1014 - if ((psta == NULL) || (psta->aid != aid)) 1014 + if (!psta || psta->aid != aid) 1015 1015 return _FAIL; 1016 1016 1017 1017 /* for rx pkt statistics */ ··· 1119 1119 RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("+validate_recv_mgnt_frame\n")); 1120 1120 1121 1121 precv_frame = recvframe_chk_defrag(padapter, precv_frame); 1122 - if (precv_frame == NULL) { 1122 + if (!precv_frame) { 1123 1123 RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("%s: fragment packet\n", __func__)); 1124 1124 return _SUCCESS; 1125 1125 } ··· 1164 1164 psa = get_sa(ptr); 1165 1165 pbssid = get_hdr_bssid(ptr); 1166 1166 1167 - if (pbssid == NULL) { 1167 + if (!pbssid) { 1168 1168 ret = _FAIL; 1169 1169 goto exit; 1170 1170 } ··· 1207 1207 goto exit; 1208 1208 } 1209 1209 1210 - if (psta == NULL) { 1210 + if (!psta) { 1211 1211 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, (" after to_fr_ds_chk; psta==NULL\n")); 1212 1212 ret = _FAIL; 1213 1213 goto exit; ··· 1547 1547 1548 1548 psta_addr = pfhdr->attrib.ta; 1549 1549 psta = rtw_get_stainfo(pstapriv, psta_addr); 1550 - if (psta == NULL) { 1550 + if (!psta) { 1551 1551 u8 type = GetFrameType(pfhdr->rx_data); 1552 1552 if (type != WIFI_DATA_TYPE) { 1553 1553 psta = rtw_get_bcmc_stainfo(padapter); ··· 1565 1565 if (ismfrag == 1) { 1566 1566 /* 0~(n-1) fragment frame */ 1567 1567 /* enqueue to defraf_g */ 1568 - if (pdefrag_q != NULL) { 1568 + if (pdefrag_q) { 1569 1569 if (fragnum == 0) { 1570 1570 /* the first fragment */ 1571 1571 if (!list_empty(&pdefrag_q->queue)) { ··· 1594 1594 if ((ismfrag == 0) && (fragnum != 0)) { 1595 1595 /* the last fragment frame */ 1596 1596 /* enqueue the last fragment */ 1597 - if (pdefrag_q != NULL) { 1597 + if (pdefrag_q) { 1598 1598 phead = get_list_head(pdefrag_q); 1599 1599 list_add_tail(&pfhdr->list, phead); 1600 1600 ··· 1611 1611 } 1612 1612 } 1613 1613 1614 - if ((prtnframe != NULL) && (prtnframe->attrib.privacy)) { 1614 + if (prtnframe && prtnframe->attrib.privacy) { 1615 1615 /* after defrag we must check tkip mic code */ 1616 1616 if (recvframe_chkmic(padapter, prtnframe) == _FAIL) { 1617 1617 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvframe_chkmic(padapter, prtnframe)==_FAIL\n")); ··· 2054 2054 rtw_led_control(padapter, LED_CTL_RX); 2055 2055 2056 2056 prframe = decryptor(padapter, prframe); 2057 - if (prframe == NULL) { 2057 + if (!prframe) { 2058 2058 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("decryptor: drop pkt\n")); 2059 2059 ret = _FAIL; 2060 2060 goto _recv_data_drop; 2061 2061 } 2062 2062 2063 2063 prframe = recvframe_chk_defrag(padapter, prframe); 2064 - if (prframe == NULL) { 2064 + if (!prframe) { 2065 2065 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvframe_chk_defrag: drop pkt\n")); 2066 2066 goto _recv_data_drop; 2067 2067 } 2068 2068 2069 2069 prframe = portctrl(padapter, prframe); 2070 - if (prframe == NULL) { 2070 + if (!prframe) { 2071 2071 RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("portctrl: drop pkt\n")); 2072 2072 ret = _FAIL; 2073 2073 goto _recv_data_drop;
+7 -7
drivers/staging/r8188eu/core/rtw_security.c
··· 95 95 struct security_priv *psecuritypriv = &padapter->securitypriv; 96 96 struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 97 97 98 - if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL) 98 + if (!((struct xmit_frame *)pxmitframe)->buf_addr) 99 99 return; 100 100 101 101 hw_hdr_offset = TXDESC_SIZE + ··· 542 542 struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 543 543 u32 res = _SUCCESS; 544 544 545 - if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL) 545 + if (!((struct xmit_frame *)pxmitframe)->buf_addr) 546 546 return _FAIL; 547 547 548 548 hw_hdr_offset = TXDESC_SIZE + ··· 555 555 else 556 556 stainfo = rtw_get_stainfo(&padapter->stapriv, &pattrib->ra[0]); 557 557 558 - if (stainfo != NULL) { 558 + if (stainfo) { 559 559 RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_encrypt: stainfo!= NULL!!!\n")); 560 560 561 561 if (IS_MCAST(pattrib->ra)) ··· 631 631 /* 4 start to decrypt recvframe */ 632 632 if (prxattrib->encrypt == _TKIP_) { 633 633 stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]); 634 - if (stainfo != NULL) { 634 + if (stainfo) { 635 635 if (IS_MCAST(prxattrib->ra)) { 636 636 if (!psecuritypriv->binstallGrpkey) { 637 637 res = _FAIL; ··· 1202 1202 /* uint offset = 0; */ 1203 1203 u32 res = _SUCCESS; 1204 1204 1205 - if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL) 1205 + if (!((struct xmit_frame *)pxmitframe)->buf_addr) 1206 1206 return _FAIL; 1207 1207 1208 1208 hw_hdr_offset = TXDESC_SIZE + ··· 1217 1217 else 1218 1218 stainfo = rtw_get_stainfo(&padapter->stapriv, &pattrib->ra[0]); 1219 1219 1220 - if (stainfo != NULL) { 1220 + if (stainfo) { 1221 1221 RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_encrypt: stainfo!= NULL!!!\n")); 1222 1222 1223 1223 if (IS_MCAST(pattrib->ra)) ··· 1456 1456 /* 4 start to encrypt each fragment */ 1457 1457 if ((prxattrib->encrypt == _AES_)) { 1458 1458 stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]); 1459 - if (stainfo != NULL) { 1459 + if (stainfo) { 1460 1460 RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_decrypt: stainfo!= NULL!!!\n")); 1461 1461 1462 1462 if (IS_MCAST(prxattrib->ra)) {
+4 -4
drivers/staging/r8188eu/core/rtw_sta_mgt.c
··· 153 153 void rtw_mfree_stainfo(struct sta_info *psta) 154 154 { 155 155 156 - if (&psta->lock != NULL) 156 + if (&psta->lock) 157 157 _rtw_spinlock_free(&psta->lock); 158 158 159 159 _rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv); ··· 333 333 struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 334 334 struct sta_priv *pstapriv = &padapter->stapriv; 335 335 336 - if (psta == NULL) 336 + if (!psta) 337 337 goto exit; 338 338 339 339 pfree_sta_queue = &pstapriv->free_sta_queue; ··· 488 488 u8 *addr; 489 489 u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 490 490 491 - if (hwaddr == NULL) 491 + if (!hwaddr) 492 492 return NULL; 493 493 494 494 if (IS_MCAST(hwaddr)) ··· 528 528 529 529 psta = rtw_alloc_stainfo(pstapriv, bcast_addr); 530 530 531 - if (psta == NULL) { 531 + if (!psta) { 532 532 res = _FAIL; 533 533 RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("rtw_alloc_stainfo fail")); 534 534 goto exit;
+5 -5
drivers/staging/r8188eu/core/rtw_wlan_util.c
··· 740 740 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 741 741 struct ht_priv *phtpriv = &pmlmepriv->htpriv; 742 742 743 - if (pIE == NULL) 743 + if (!pIE) 744 744 return; 745 745 746 746 if (!phtpriv->ht_option) ··· 787 787 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 788 788 struct ht_priv *phtpriv = &pmlmepriv->htpriv; 789 789 790 - if (pIE == NULL) 790 + if (!pIE) 791 791 return; 792 792 793 793 if (!phtpriv->ht_option) ··· 986 986 987 987 /* checking SSID */ 988 988 p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); 989 - if (p == NULL) { 989 + if (!p) { 990 990 DBG_88E("%s marc: cannot find SSID for survey event\n", __func__); 991 991 hidden_ssid = true; 992 992 } else { ··· 1590 1590 struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 1591 1591 1592 1592 pIE = (struct ndis_802_11_var_ie *)rtw_get_ie(pvar_ie, _SUPPORTEDRATES_IE_, &ie_len, var_ie_len); 1593 - if (pIE == NULL) 1593 + if (!pIE) 1594 1594 return _FAIL; 1595 1595 1596 1596 memcpy(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates, pIE->data, ie_len); ··· 1657 1657 int status = _SUCCESS; 1658 1658 1659 1659 if (init) { 1660 - if (pbuddy_padapter == NULL) { 1660 + if (!pbuddy_padapter) { 1661 1661 pbuddy_padapter = adapter; 1662 1662 DBG_88E("%s(): pbuddy_padapter == NULL, Set pbuddy_padapter\n", __func__); 1663 1663 } else {
+20 -20
drivers/staging/r8188eu/core/rtw_xmit.c
··· 74 74 75 75 pxmitpriv->pallocated_frame_buf = rtw_zvmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4); 76 76 77 - if (pxmitpriv->pallocated_frame_buf == NULL) { 77 + if (!pxmitpriv->pallocated_frame_buf) { 78 78 pxmitpriv->pxmit_frame_buf = NULL; 79 79 RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xmit_frame fail!\n")); 80 80 res = _FAIL; ··· 112 112 113 113 pxmitpriv->pallocated_xmitbuf = rtw_zvmalloc(NR_XMITBUFF * sizeof(struct xmit_buf) + 4); 114 114 115 - if (pxmitpriv->pallocated_xmitbuf == NULL) { 115 + if (!pxmitpriv->pallocated_xmitbuf) { 116 116 RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xmit_buf fail!\n")); 117 117 res = _FAIL; 118 118 goto exit; ··· 154 154 155 155 pxmitpriv->pallocated_xmit_extbuf = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_buf) + 4); 156 156 157 - if (pxmitpriv->pallocated_xmit_extbuf == NULL) { 157 + if (!pxmitpriv->pallocated_xmit_extbuf) { 158 158 RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xmit_extbuf fail!\n")); 159 159 res = _FAIL; 160 160 goto exit; ··· 238 238 239 239 rtw_mfree_xmit_priv_lock(pxmitpriv); 240 240 241 - if (pxmitpriv->pxmit_frame_buf == NULL) 241 + if (!pxmitpriv->pxmit_frame_buf) 242 242 return; 243 243 244 244 for (i = 0; i < NR_XMITFRAME; i++) { ··· 509 509 psta = rtw_get_bcmc_stainfo(padapter); 510 510 } else { 511 511 psta = rtw_get_stainfo(pstapriv, pattrib->ra); 512 - if (psta == NULL) { /* if we cannot get psta => drrp the pkt */ 512 + if (!psta) { /* if we cannot get psta => drrp the pkt */ 513 513 RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, ("\nupdate_attrib => get sta_info fail, ra: %pM\n", (pattrib->ra))); 514 514 res = _FAIL; 515 515 goto exit; ··· 656 656 657 657 if (pattrib->encrypt == _TKIP_) {/* if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_PRIVACY_) */ 658 658 /* encode mic code */ 659 - if (stainfo != NULL) { 659 + if (stainfo) { 660 660 u8 null_key[16] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 661 661 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 662 662 0x0, 0x0}; ··· 992 992 993 993 psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); 994 994 995 - if (psta == NULL) 995 + if (!psta) 996 996 return _FAIL; 997 997 998 - if (pxmitframe->buf_addr == NULL) { 998 + if (!pxmitframe->buf_addr) { 999 999 DBG_88E("==> %s buf_addr == NULL\n", __func__); 1000 1000 return _FAIL; 1001 1001 } ··· 1033 1033 1034 1034 /* adding icv, if necessary... */ 1035 1035 if (pattrib->iv_len) { 1036 - if (psta != NULL) { 1036 + if (psta) { 1037 1037 switch (pattrib->encrypt) { 1038 1038 case _WEP40_: 1039 1039 case _WEP104_: ··· 1177 1177 case AUTO_VCS: 1178 1178 default: 1179 1179 perp = rtw_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len); 1180 - if (perp == NULL) { 1180 + if (!perp) { 1181 1181 pxmitpriv->vcs = NONE_VCS; 1182 1182 } else { 1183 1183 protection = (*(perp + 2)) & BIT(1); ··· 1236 1236 list_del_init(&(pxmitbuf->list)); 1237 1237 } 1238 1238 1239 - if (pxmitbuf != NULL) { 1239 + if (pxmitbuf) { 1240 1240 pxmitpriv->free_xmit_extbuf_cnt--; 1241 1241 1242 1242 pxmitbuf->priv_data = NULL; ··· 1258 1258 struct __queue *pfree_queue = &pxmitpriv->free_xmit_extbuf_queue; 1259 1259 unsigned long flags; 1260 1260 1261 - if (pxmitbuf == NULL) 1261 + if (!pxmitbuf) 1262 1262 return _FAIL; 1263 1263 1264 1264 spin_lock_irqsave(&pfree_queue->lock, flags); ··· 1296 1296 list_del_init(&(pxmitbuf->list)); 1297 1297 } 1298 1298 1299 - if (pxmitbuf != NULL) { 1299 + if (pxmitbuf) { 1300 1300 pxmitpriv->free_xmitbuf_cnt--; 1301 1301 pxmitbuf->priv_data = NULL; 1302 1302 if (pxmitbuf->sctx) { ··· 1314 1314 struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; 1315 1315 unsigned long flags; 1316 1316 1317 - if (pxmitbuf == NULL) 1317 + if (!pxmitbuf) 1318 1318 return _FAIL; 1319 1319 1320 1320 if (pxmitbuf->sctx) { ··· 1377 1377 list_del_init(&(pxframe->list)); 1378 1378 } 1379 1379 1380 - if (pxframe != NULL) { /* default value setting */ 1380 + if (pxframe) { /* default value setting */ 1381 1381 pxmitpriv->free_xmitframe_cnt--; 1382 1382 1383 1383 RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("rtw_alloc_xmitframe():free_xmitframe_cnt=%d\n", pxmitpriv->free_xmitframe_cnt)); ··· 1408 1408 struct adapter *padapter = pxmitpriv->adapter; 1409 1409 struct sk_buff *pndis_pkt = NULL; 1410 1410 1411 - if (pxmitframe == NULL) { 1411 + if (!pxmitframe) { 1412 1412 RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("====== rtw_free_xmitframe():pxmitframe == NULL!!!!!!!!!!\n")); 1413 1413 goto exit; 1414 1414 } ··· 1598 1598 psta = rtw_get_stainfo(pstapriv, pattrib->ra); 1599 1599 } 1600 1600 1601 - if (psta == NULL) { 1601 + if (!psta) { 1602 1602 res = _FAIL; 1603 1603 DBG_88E("rtw_xmit_classifier: psta == NULL\n"); 1604 1604 RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("rtw_xmit_classifier: psta == NULL\n")); ··· 1727 1727 } 1728 1728 1729 1729 newskb = skb_copy(skb, GFP_ATOMIC); 1730 - if (newskb == NULL) { 1730 + if (!newskb) { 1731 1731 DEBUG_ERR("TX DROP: skb_copy fail!\n"); 1732 1732 return -1; 1733 1733 } ··· 1847 1847 s32 res; 1848 1848 1849 1849 pxmitframe = rtw_alloc_xmitframe(pxmitpriv); 1850 - if (pxmitframe == NULL) { 1850 + if (!pxmitframe) { 1851 1851 RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("rtw_xmit: no more pxmitframe\n")); 1852 1852 DBG_88E("DBG_TX_DROP_FRAME %s no more pxmitframe\n", __func__); 1853 1853 return -1; ··· 1912 1912 else 1913 1913 psta = rtw_get_stainfo(pstapriv, pattrib->ra); 1914 1914 1915 - if (psta == NULL) 1915 + if (!psta) 1916 1916 return ret; 1917 1917 1918 1918 if (pattrib->triggered == 1) {