[PATCH v3] staging: rtl8723bs: use PTR_ALIGN() for rsp_buf
From: Devansh Soni
Date: Tue Jun 16 2026 - 08:41:46 EST
The original code was using manual bitwise calculation for the
alignment of rsp_buf.
Replace this with the standard PTR_ALIGN() macro. The manual math
((SIZE_PTR)ptr & 3) always returns 0 and is completely unnecessary
because kzalloc() already returns 8-byte aligned memory.
Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Devansh Soni <devanshsoni874@xxxxxxxxx>
---
Changes in v3:
- Replaced manual bitwise math with PTR_ALIGN() macro based on feedback
by Dan.
- Updated commit message to detail kzalloc() 8-byte alignment guarantees.
Changes in v2:
- Wrapped commit log text to resolve line length issue noted by Greg.
drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index c1185c25e..38ce3156c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -184,7 +184,7 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
return -ENOMEM;
}
- pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
+ pcmdpriv->rsp_buf = PTR_ALIGN(pcmdpriv->rsp_allocated_buf, 4);
pcmdpriv->cmd_issued_cnt = 0;
pcmdpriv->cmd_done_cnt = 0;
--
2.54.0