]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: rtl8723bs: use PTR_ALIGN for buffer alignment
authorMinu Jin <s9430939@naver.com>
Sun, 28 Dec 2025 14:58:23 +0000 (23:58 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Jan 2026 12:52:41 +0000 (13:52 +0100)
Replace manual pointer alignment calculation with the standard PTR_ALIGN
macro in rtw_init_cmd_priv()

This improves code readability and ensures the use of kernel's
preferred alignment mechanism instead of manual calculation

Signed-off-by: Minu Jin <s9430939@naver.com>
Link: https://patch.msgid.link/20251228145823.3250174-1-s9430939@naver.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_cmd.c

index 27eddd22e064f7e57217c75dfc98f8443e180d82..d746f0d205ea42bda64c7b9e9b3bef1a22e365f5 100644 (file)
@@ -7,6 +7,7 @@
 #include <drv_types.h>
 #include <hal_btcoex.h>
 #include <linux/jiffies.h>
+#include <linux/align.h>
 
 static struct _cmd_callback rtw_cmd_callback[] = {
        {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
@@ -175,7 +176,7 @@ int rtw_init_cmd_priv(struct        cmd_priv *pcmdpriv)
        if (!pcmdpriv->cmd_allocated_buf)
                return -ENOMEM;
 
-       pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf  +  CMDBUFF_ALIGN_SZ - ((SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1));
+       pcmdpriv->cmd_buf = PTR_ALIGN(pcmdpriv->cmd_allocated_buf, CMDBUFF_ALIGN_SZ);
 
        pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);