]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
staging: rtl8723bs: replace rtw_malloc() with kmalloc()
authorMinu Jin <s9430939@naver.com>
Wed, 4 Feb 2026 13:13:44 +0000 (22:13 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Feb 2026 13:35:28 +0000 (14:35 +0100)
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>
drivers/staging/rtl8723bs/core/rtw_cmd.c
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
drivers/staging/rtl8723bs/hal/sdio_ops.c

index 27da987d881f4891c22b9ea120d907ae79dabf7d..edec2295b52d3a224ea6c7c9992ef77b7dfa52e9 100644 (file)
@@ -1695,7 +1695,7 @@ static void c2h_wk_callback(struct work_struct *work)
                        /* This C2H event is read, clear it */
                        c2h_evt_clear(adapter);
                } else {
-                       c2h_evt = rtw_malloc(16);
+                       c2h_evt = kmalloc(16, GFP_ATOMIC);
                        if (c2h_evt) {
                                /* This C2H event is not read, read & clear now */
                                if (c2h_evt_read_88xx(adapter, c2h_evt) != _SUCCESS) {
index 318feb4652386012ed3166e672e63bfbd46479bd..223decf40824998b13323bfa355ccd4c829e244d 100644 (file)
@@ -586,7 +586,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame)
        if (!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) {
                if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) {
                        /* we should update current network before auth, or some IE is wrong */
-                       pbss = rtw_malloc(sizeof(struct wlan_bssid_ex));
+                       pbss = kmalloc(sizeof(*pbss), GFP_ATOMIC);
                        if (pbss) {
                                if (collect_bss_info(padapter, precv_frame, pbss) == _SUCCESS) {
                                        update_network(&(pmlmepriv->cur_network.network), pbss, padapter, true);
index 0065226c9bd230c202f0fa1e08c0b4313f6a0197..31376cb8fca0fc45465359ae238ec13ae6015864 100644 (file)
@@ -640,7 +640,7 @@ static void hal_ReadEFuse_WiFi(
        if ((_offset + _size_byte) > EFUSE_MAX_MAP_LEN)
                return;
 
-       efuseTbl = rtw_malloc(EFUSE_MAX_MAP_LEN);
+       efuseTbl = kmalloc(EFUSE_MAX_MAP_LEN, GFP_ATOMIC);
        if (!efuseTbl)
                return;
 
@@ -728,7 +728,7 @@ static void hal_ReadEFuse_BT(
        if ((_offset + _size_byte) > EFUSE_BT_MAP_LEN)
                return;
 
-       efuseTbl = rtw_malloc(EFUSE_BT_MAP_LEN);
+       efuseTbl = kmalloc(EFUSE_BT_MAP_LEN, GFP_ATOMIC);
        if (!efuseTbl)
                return;
 
index 454f2fabc11607b6ab5d02daaab231d6ff82fdc6..707e5879d943eec6b18c9d4fa17b8fd9b79e8cd7 100644 (file)
@@ -181,7 +181,7 @@ static u32 sdio_read32(struct intf_hdl *intfhdl, u32 addr)
        } else {
                u8 *tmpbuf;
 
-               tmpbuf = rtw_malloc(8);
+               tmpbuf = kmalloc(8, GFP_ATOMIC);
                if (!tmpbuf)
                        return SDIO_ERR_VAL32;
 
@@ -228,9 +228,9 @@ static s32 sdio_readN(struct intf_hdl *intfhdl, u32 addr, u32 cnt, u8 *buf)
 
                ftaddr &= ~(u16)0x3;
                n = cnt + shift;
-               tmpbuf = rtw_malloc(n);
+               tmpbuf = kmalloc(n, GFP_ATOMIC);
                if (!tmpbuf)
-                       return -1;
+                       return -ENOMEM;
 
                err = sd_read(intfhdl, ftaddr, n, tmpbuf);
                if (!err)
@@ -331,9 +331,9 @@ static s32 sdio_writeN(struct intf_hdl *intfhdl, u32 addr, u32 cnt, u8 *buf)
 
                ftaddr &= ~(u16)0x3;
                n = cnt + shift;
-               tmpbuf = rtw_malloc(n);
+               tmpbuf = kmalloc(n, GFP_ATOMIC);
                if (!tmpbuf)
-                       return -1;
+                       return -ENOMEM;
                err = sd_read(intfhdl, ftaddr, 4, tmpbuf);
                if (err) {
                        kfree(tmpbuf);
@@ -503,9 +503,9 @@ static s32 _sdio_local_read(
                return _sd_cmd52_read(intfhdl, addr, cnt, buf);
 
        n = round_up(cnt, 4);
-       tmpbuf = rtw_malloc(n);
+       tmpbuf = kmalloc(n, GFP_ATOMIC);
        if (!tmpbuf)
-               return -1;
+               return -ENOMEM;
 
        err = _sd_read(intfhdl, addr, n, tmpbuf);
        if (!err)
@@ -544,9 +544,9 @@ s32 sdio_local_read(
                return sd_cmd52_read(intfhdl, addr, cnt, buf);
 
        n = round_up(cnt, 4);
-       tmpbuf = rtw_malloc(n);
+       tmpbuf = kmalloc(n, GFP_ATOMIC);
        if (!tmpbuf)
-               return -1;
+               return -ENOMEM;
 
        err = sd_read(intfhdl, addr, n, tmpbuf);
        if (!err)
@@ -583,9 +583,9 @@ s32 sdio_local_write(
        )
                return sd_cmd52_write(intfhdl, addr, cnt, buf);
 
-       tmpbuf = rtw_malloc(cnt);
+       tmpbuf = kmalloc(cnt, GFP_ATOMIC);
        if (!tmpbuf)
-               return -1;
+               return -ENOMEM;
 
        memcpy(tmpbuf, buf, cnt);
 
@@ -883,7 +883,7 @@ void sd_int_dpc(struct adapter *adapter)
                u8 *status;
                u32 addr;
 
-               status = rtw_malloc(4);
+               status = kmalloc(4, GFP_ATOMIC);
                if (status) {
                        addr = REG_TXDMA_STATUS;
                        hal_sdio_get_cmd_addr_8723b(adapter, WLAN_IOREG_DEVICE_ID, addr, &addr);