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

Configure Feed

Select the types of activity you want to include in your feed.

staging: rtl8723bs: replace rtw_malloc() with kmalloc()

Replace the wrapper function rtw_malloc() with standard kmalloc().
Call sites were reviewed to use appropriate GFP flags (GFP_KERNEL or
GFP_ATOMIC) based on the execution context.

About GFP Flags:
- GFP_ATOMIC is used for allocations in atomic contexts such as
spinlock-protected sections, tasklets, and timer handlers.
- GFP_KERNEL is used for process contexts where sleeping is allowed.

Also, convert error return codes from -1 to -ENOMEM where appropriate.

Signed-off-by: Minu Jin <s9430939@naver.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Link: https://patch.msgid.link/20260204131347.3515949-3-s9430939@naver.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Minu Jin and committed by
Greg Kroah-Hartman
9577f3b3 5ed9ef27

+16 -16
+1 -1
drivers/staging/rtl8723bs/core/rtw_cmd.c
··· 1695 1695 /* This C2H event is read, clear it */ 1696 1696 c2h_evt_clear(adapter); 1697 1697 } else { 1698 - c2h_evt = rtw_malloc(16); 1698 + c2h_evt = kmalloc(16, GFP_ATOMIC); 1699 1699 if (c2h_evt) { 1700 1700 /* This C2H event is not read, read & clear now */ 1701 1701 if (c2h_evt_read_88xx(adapter, c2h_evt) != _SUCCESS) {
+1 -1
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
··· 586 586 if (!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) { 587 587 if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { 588 588 /* we should update current network before auth, or some IE is wrong */ 589 - pbss = rtw_malloc(sizeof(struct wlan_bssid_ex)); 589 + pbss = kmalloc(sizeof(*pbss), GFP_ATOMIC); 590 590 if (pbss) { 591 591 if (collect_bss_info(padapter, precv_frame, pbss) == _SUCCESS) { 592 592 update_network(&(pmlmepriv->cur_network.network), pbss, padapter, true);
+2 -2
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
··· 640 640 if ((_offset + _size_byte) > EFUSE_MAX_MAP_LEN) 641 641 return; 642 642 643 - efuseTbl = rtw_malloc(EFUSE_MAX_MAP_LEN); 643 + efuseTbl = kmalloc(EFUSE_MAX_MAP_LEN, GFP_ATOMIC); 644 644 if (!efuseTbl) 645 645 return; 646 646 ··· 728 728 if ((_offset + _size_byte) > EFUSE_BT_MAP_LEN) 729 729 return; 730 730 731 - efuseTbl = rtw_malloc(EFUSE_BT_MAP_LEN); 731 + efuseTbl = kmalloc(EFUSE_BT_MAP_LEN, GFP_ATOMIC); 732 732 if (!efuseTbl) 733 733 return; 734 734
+12 -12
drivers/staging/rtl8723bs/hal/sdio_ops.c
··· 181 181 } else { 182 182 u8 *tmpbuf; 183 183 184 - tmpbuf = rtw_malloc(8); 184 + tmpbuf = kmalloc(8, GFP_ATOMIC); 185 185 if (!tmpbuf) 186 186 return SDIO_ERR_VAL32; 187 187 ··· 228 228 229 229 ftaddr &= ~(u16)0x3; 230 230 n = cnt + shift; 231 - tmpbuf = rtw_malloc(n); 231 + tmpbuf = kmalloc(n, GFP_ATOMIC); 232 232 if (!tmpbuf) 233 - return -1; 233 + return -ENOMEM; 234 234 235 235 err = sd_read(intfhdl, ftaddr, n, tmpbuf); 236 236 if (!err) ··· 331 331 332 332 ftaddr &= ~(u16)0x3; 333 333 n = cnt + shift; 334 - tmpbuf = rtw_malloc(n); 334 + tmpbuf = kmalloc(n, GFP_ATOMIC); 335 335 if (!tmpbuf) 336 - return -1; 336 + return -ENOMEM; 337 337 err = sd_read(intfhdl, ftaddr, 4, tmpbuf); 338 338 if (err) { 339 339 kfree(tmpbuf); ··· 503 503 return _sd_cmd52_read(intfhdl, addr, cnt, buf); 504 504 505 505 n = round_up(cnt, 4); 506 - tmpbuf = rtw_malloc(n); 506 + tmpbuf = kmalloc(n, GFP_ATOMIC); 507 507 if (!tmpbuf) 508 - return -1; 508 + return -ENOMEM; 509 509 510 510 err = _sd_read(intfhdl, addr, n, tmpbuf); 511 511 if (!err) ··· 544 544 return sd_cmd52_read(intfhdl, addr, cnt, buf); 545 545 546 546 n = round_up(cnt, 4); 547 - tmpbuf = rtw_malloc(n); 547 + tmpbuf = kmalloc(n, GFP_ATOMIC); 548 548 if (!tmpbuf) 549 - return -1; 549 + return -ENOMEM; 550 550 551 551 err = sd_read(intfhdl, addr, n, tmpbuf); 552 552 if (!err) ··· 583 583 ) 584 584 return sd_cmd52_write(intfhdl, addr, cnt, buf); 585 585 586 - tmpbuf = rtw_malloc(cnt); 586 + tmpbuf = kmalloc(cnt, GFP_ATOMIC); 587 587 if (!tmpbuf) 588 - return -1; 588 + return -ENOMEM; 589 589 590 590 memcpy(tmpbuf, buf, cnt); 591 591 ··· 883 883 u8 *status; 884 884 u32 addr; 885 885 886 - status = rtw_malloc(4); 886 + status = kmalloc(4, GFP_ATOMIC); 887 887 if (status) { 888 888 addr = REG_TXDMA_STATUS; 889 889 hal_sdio_get_cmd_addr_8723b(adapter, WLAN_IOREG_DEVICE_ID, addr, &addr);