From: Rosen Penev <rosenp@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Arend van Spriel <arend.vanspriel@broadcom.com>,
brcm80211@lists.linux.dev (open list:BROADCOM BRCM80211
IEEE802.11 WIRELESS DRIVERS),
brcm80211-dev-list.pdl@broadcom.com (open list:BROADCOM
BRCM80211 IEEE802.11 WIRELESS DRIVERS),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCHv2 wireless-next] wifi: brcmsmac: use FAM for debug code
Date: Mon, 9 Mar 2026 14:59:07 -0700 [thread overview]
Message-ID: <20260309215907.5789-1-rosenp@gmail.com> (raw)
Debug code requires a separate allocation to duplicate a string. A FAM
allows properly sized allocation with a single kfree.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
v2: rebase and remove debug from member.
.../broadcom/brcm80211/brcmsmac/mac80211_if.c | 15 +++++----------
.../broadcom/brcm80211/brcmsmac/mac80211_if.h | 4 +---
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
index 6255d673d2d3..7912a999f6f7 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
@@ -317,9 +317,6 @@ static void brcms_free(struct brcms_info *wl)
/* free timers */
for (t = wl->timers; t; t = next) {
next = t->next;
-#ifdef DEBUG
- kfree(t->name);
-#endif
kfree(t);
}
}
@@ -1499,7 +1496,11 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
{
struct brcms_timer *t;
+#ifdef DEBUG
+ t = kzalloc_flex(*t, name, strlen(name) + 1, GFP_ATOMIC);
+#else
t = kzalloc_obj(*t, GFP_ATOMIC);
+#endif
if (!t)
return NULL;
@@ -1511,7 +1512,7 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
wl->timers = t;
#ifdef DEBUG
- t->name = kstrdup(name, GFP_ATOMIC);
+ strcpy(t->name, name);
#endif
return t;
@@ -1574,9 +1575,6 @@ void brcms_free_timer(struct brcms_timer *t)
if (wl->timers == t) {
wl->timers = wl->timers->next;
-#ifdef DEBUG
- kfree(t->name);
-#endif
kfree(t);
return;
@@ -1586,9 +1584,6 @@ void brcms_free_timer(struct brcms_timer *t)
while (tmp) {
if (tmp->next == t) {
tmp->next = t->next;
-#ifdef DEBUG
- kfree(t->name);
-#endif
kfree(t);
return;
}
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h
index eaf926a96a88..3b25a56958b3 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h
@@ -42,9 +42,7 @@ struct brcms_timer {
bool periodic;
bool set; /* indicates if timer is active */
struct brcms_timer *next; /* for freeing on unload */
-#ifdef DEBUG
- char *name; /* Description of the timer */
-#endif
+ char name[]; /* Description of the timer */
};
struct brcms_if {
--
2.53.0
next reply other threads:[~2026-03-09 21:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 21:59 Rosen Penev [this message]
2026-03-10 1:11 ` [PATCHv2 wireless-next] wifi: brcmsmac: use FAM for debug code Julian Calaby
2026-03-10 1:47 ` Rosen Penev
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=20260309215907.5789-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox