public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] remove memory allocation wrappers
@ 2026-01-31 19:29 Minu Jin
  2026-01-31 19:29 ` [PATCH v4 1/4] staging: rtl8723bs: replace rtw_malloc() with kmalloc() Minu Jin
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Minu Jin @ 2026-01-31 19:29 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, trohan2000, andy, linux-staging, straube.linux,
	linux-kernel, Minu Jin

Replace redundant wrapper functions with kernel APIs
kmalloc(), kzalloc(), skb_copy() and __dev_alloc_skb().

The original wrappers relied on in_interrupt() check to decide between
GFP_ATOMIC and GFP_KERNEL.
So, I have analyzed call sites to apply the appropriate GFP flag based
on the context.

- GFP_ATOMIC: For data paths, tasklets, timer handlers, spinlock, and
  functions called within atomic contexts.

- GFP_KERNEL: For driver initialization (init/probe), configuration
  setups, and process contexts where sleeping is allowed.

I would appreciate a review to ensure that these flags were correctly
identified for each context.

About the usage of kmemdup():
        while Andy suggested a fallback to kmalloc() when the source is
        NULL, I chose to skip allocation in those cases. This is to
        maintain consistency with original logic, which only performed
        copy when the source data was valid.

Changes in v4
(suggested by Andy Shevchenko)
- Use kmemdup() where applicable.
- Use array_size(), size_add() for overflow safe allocations.
- Use sizeof(*ptr) instead of sizeof(struct val) for
  better maintainability.

Changes in v3
- I have analyzed each call site to apply the appropriate GFP flags
  based on the execution context.

- Improved the logical separation of patches to maintain git bisect

- Removed redundant definitions and unused macros (e.g., rtw_skb_alloc_f)
  in the final cleanup patch.

Minu Jin (4):
  staging: rtl8723bs: replace rtw_malloc() with kmalloc()
  staging: rtl8723bs: replace rtw_zmalloc() with kzalloc()
  staging: rtl8723bs: replace skb allocation, copy wrappers
  staging: rtl8723bs: remove unused allocation wrapper functions

 drivers/staging/rtl8723bs/core/rtw_ap.c       | 20 ++---
 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 83 +++++++++----------
 drivers/staging/rtl8723bs/core/rtw_mlme.c     | 12 +--
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 41 +++++----
 drivers/staging/rtl8723bs/core/rtw_recv.c     |  4 +-
 drivers/staging/rtl8723bs/core/rtw_security.c |  3 +-
 .../staging/rtl8723bs/core/rtw_wlan_util.c    |  2 +-
 drivers/staging/rtl8723bs/core/rtw_xmit.c     |  8 +-
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c |  4 +-
 .../staging/rtl8723bs/hal/rtl8723bs_recv.c    |  8 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c      | 18 ++--
 .../staging/rtl8723bs/include/osdep_service.h | 11 ---
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 23 ++---
 drivers/staging/rtl8723bs/os_dep/os_intfs.c   |  2 +-
 .../staging/rtl8723bs/os_dep/osdep_service.c  | 30 +------
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c |  4 +-
 16 files changed, 113 insertions(+), 160 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-02-03 15:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31 19:29 [PATCH v4 0/4] remove memory allocation wrappers Minu Jin
2026-01-31 19:29 ` [PATCH v4 1/4] staging: rtl8723bs: replace rtw_malloc() with kmalloc() Minu Jin
2026-02-03 14:52   ` Andy Shevchenko
2026-01-31 19:29 ` [PATCH v4 2/4] staging: rtl8723bs: replace rtw_zmalloc() with kzalloc() Minu Jin
2026-02-03 15:11   ` Andy Shevchenko
2026-01-31 19:30 ` [PATCH v4 3/4] staging: rtl8723bs: replace skb allocation, copy wrappers Minu Jin
2026-02-03 15:13   ` Andy Shevchenko
2026-01-31 19:30 ` [PATCH v4 4/4] staging: rtl8723bs: remove unused allocation wrapper functions Minu Jin
2026-02-03 15:14   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox