From: Ashmit Kumar <work.ashmitkumar@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Ashmit Kumar <work.ashmitkumar@gmail.com>
Subject: [PATCH 2/3] staging: rtl8723bs: remove unnecessary pointer-to-integer casts
Date: Sun, 18 Oct 2026 16:44:01 +0000 [thread overview]
Message-ID: <20261018164403.14921-3-work.ashmitkumar@gmail.com> (raw)
In-Reply-To: <20261018164403.14921-1-work.ashmitkumar@gmail.com>
The pointer pframe in rtw_mlme_ext.c is cast to (SIZE_PTR) before
being passed as an argument or evaluated in expressions where it is
already a pointer type. In xmit_linux.c, the buffer length was
calculated using unnecessary casts:
(SIZE_PTR)pfile->cur_addr - (SIZE_PTR)pfile->buf_start
where standard pointer subtraction pfile->cur_addr - pfile->buf_start
yields ptrdiff_t directly without any casting.
Remove these redundant casts to simplify the code and use standard C
pointer arithmetic.
Signed-off-by: Ashmit Kumar <work.ashmitkumar@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 ++++----
drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 511eccf5b5a3..9e89d4a0392d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -707,8 +707,8 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
offset = 4;
}
- algorithm = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset));
- seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2));
+ algorithm = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + offset));
+ seq = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + offset + 2));
if (auth_mode == 2 &&
psecuritypriv->dot11_privacy_algrthm != _WEP40_ &&
@@ -856,8 +856,8 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram
offset = (GetPrivacy(pframe)) ? 4 : 0;
- seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2));
- status = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4));
+ seq = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + offset + 2));
+ status = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + offset + 4));
if (status != 0) {
if (status == 13) { /* pmlmeinfo->auth_algo == dot11_auth_algrthm_auto) */
diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 6ee2a1f29aa4..91ab0f8bcb69 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -9,7 +9,7 @@
unsigned int rtw_remainder_len(struct pkt_file *pfile)
{
- return (pfile->buf_len - ((SIZE_PTR)(pfile->cur_addr) - (SIZE_PTR)(pfile->buf_start)));
+ return pfile->buf_len - (pfile->cur_addr - pfile->buf_start);
}
void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
--
2.43.0
next prev parent reply other threads:[~2026-10-18 16:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 16:43 [PATCH 0/3] staging: rtl8723bs: clean up SIZE_PTR usage and remove custom macro Ashmit Kumar
2026-10-18 16:44 ` [PATCH 1/3] staging: rtl8723bs: use PTR_ALIGN() for pointer alignment Ashmit Kumar
2026-10-18 16:44 ` Ashmit Kumar [this message]
2026-10-18 16:44 ` [PATCH 3/3] staging: rtl8723bs: replace SIZE_PTR with uintptr_t and remove definition Ashmit Kumar
2026-10-19 7:16 ` [PATCH 0/3] staging: rtl8723bs: clean up SIZE_PTR usage and remove custom macro Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261018164403.14921-3-work.ashmitkumar@gmail.com \
--to=work.ashmitkumar@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.