From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
To: Rosen Penev <rosenp@gmail.com>, linux-wireless@vger.kernel.org
Cc: "Toke Høiland-Jørgensen" <toke@toke.dk>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH ath-next] wifi: ath9k: use kmemdup and kcalloc
Date: Thu, 16 Apr 2026 16:09:37 -0700 [thread overview]
Message-ID: <2e123142-b931-45e1-98e4-dc7283266d10@oss.qualcomm.com> (raw)
In-Reply-To: <20260223224445.27352-1-rosenp@gmail.com>
On 2/23/2026 2:44 PM, Rosen Penev wrote:
> Simplifies the code slightly by removing temporary variables.
> multiplication overflow is also gained for free.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/net/wireless/ath/ath9k/ar9002_hw.c | 6 +++---
> drivers/net/wireless/ath/ath9k/common-init.c | 8 ++------
> drivers/net/wireless/ath/ath9k/init.c | 8 +++-----
> drivers/net/wireless/ath/ath9k/recv.c | 4 +---
> 4 files changed, 9 insertions(+), 17 deletions(-)
>
...
> diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
> index b52ddb237dcf..e52775dda6a7 100644
> --- a/drivers/net/wireless/ath/ath9k/init.c
> +++ b/drivers/net/wireless/ath/ath9k/init.c
> @@ -297,7 +297,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
> {
> struct ath_common *common = ath9k_hw_common(sc->sc_ah);
> u8 *ds;
> - int i, bsize, desc_len;
> + int i, desc_len;
>
> ath_dbg(common, CONFIG, "%s DMA: %u buffers %u desc/buf\n",
> name, nbuf, ndesc);
> @@ -351,8 +351,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
> if (is_tx) {
> struct ath_buf *bf;
>
> - bsize = sizeof(struct ath_buf) * nbuf;
> - bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL);
> + bf = devm_kcalloc(sc->dev, sizeof(*bf), nbuf, GFP_KERNEL);
> if (!bf)
> return -ENOMEM;
>
> @@ -382,8 +381,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
> } else {
> struct ath_rxbuf *bf;
>
> - bsize = sizeof(struct ath_rxbuf) * nbuf;
> - bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL);
> + bf = devm_kcalloc(sc->dev, sizeof(struct ath_rxbuf), nbuf, GFP_KERNEL);
use sizeof(*bf) here as well?
If so, I can fix this in my pending branch
> if (!bf)
> return -ENOMEM;
>
> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
> index 34c74ed99b7b..93b41a1bb2af 100644
> --- a/drivers/net/wireless/ath/ath9k/recv.c
> +++ b/drivers/net/wireless/ath/ath9k/recv.c
> @@ -202,7 +202,6 @@ static int ath_rx_edma_init(struct ath_softc *sc, int nbufs)
> struct sk_buff *skb;
> struct ath_rxbuf *bf;
> int error = 0, i;
> - u32 size;
>
> ath9k_hw_set_rx_bufsize(ah, common->rx_bufsize -
> ah->caps.rx_status_len);
> @@ -212,8 +211,7 @@ static int ath_rx_edma_init(struct ath_softc *sc, int nbufs)
> ath_rx_edma_init_queue(&sc->rx.rx_edma[ATH9K_RX_QUEUE_HP],
> ah->caps.rx_hp_qdepth);
>
> - size = sizeof(struct ath_rxbuf) * nbufs;
> - bf = devm_kzalloc(sc->dev, size, GFP_KERNEL);
> + bf = devm_kcalloc(sc->dev, sizeof(struct ath_rxbuf), nbufs, GFP_KERNEL);
here as well?
> if (!bf)
> return -ENOMEM;
>
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-04-16 23:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 22:44 [PATCH ath-next] wifi: ath9k: use kmemdup and kcalloc Rosen Penev
2026-04-16 19:21 ` Toke Høiland-Jørgensen
2026-04-16 23:09 ` Jeff Johnson [this message]
2026-04-16 23:42 ` 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=2e123142-b931-45e1-98e4-dc7283266d10@oss.qualcomm.com \
--to=jeff.johnson@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=rosenp@gmail.com \
--cc=toke@toke.dk \
/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