From: Dan Carpenter <error27@gmail.com>
To: Joakim Zhang <qiangqing.zhang@nxp.com>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com
Subject: [bug report] net: stmmac: fix dma physical address of descriptor when display ring
Date: Tue, 23 Jun 2026 12:38:42 +0300 [thread overview]
Message-ID: <ajpUIqyVSsWMY30x@stanley.mountain> (raw)
Hello Joakim Zhang,
Commit bfaf91ca848e ("net: stmmac: fix dma physical address of
descriptor when display ring") from Feb 25, 2021 (linux-next), leads
to the following Smatch static checker warning:
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c:431 dwmac4_display_ring()
warn: duplicate check 'desc_size == 32' (previous on line 418)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
399 static void dwmac4_display_ring(void *head, unsigned int size, bool rx,
400 dma_addr_t dma_rx_phy, unsigned int desc_size)
401 {
402 dma_addr_t dma_addr;
403 int i;
404
405 pr_info("%s descriptor ring:\n", rx ? "RX" : "TX");
406
407 if (desc_size == sizeof(struct dma_desc)) {
408 struct dma_desc *p = (struct dma_desc *)head;
409
410 for (i = 0; i < size; i++) {
411 dma_addr = dma_rx_phy + i * sizeof(*p);
412 pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
413 i, &dma_addr,
414 le32_to_cpu(p->des0), le32_to_cpu(p->des1),
415 le32_to_cpu(p->des2), le32_to_cpu(p->des3));
416 p++;
417 }
418 } else if (desc_size == sizeof(struct dma_extended_desc)) {
419 struct dma_extended_desc *extp = (struct dma_extended_desc *)head;
420
421 for (i = 0; i < size; i++) {
422 dma_addr = dma_rx_phy + i * sizeof(*extp);
423 pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
424 i, &dma_addr,
425 le32_to_cpu(extp->basic.des0), le32_to_cpu(extp->basic.des1),
426 le32_to_cpu(extp->basic.des2), le32_to_cpu(extp->basic.des3),
427 le32_to_cpu(extp->des4), le32_to_cpu(extp->des5),
428 le32_to_cpu(extp->des6), le32_to_cpu(extp->des7));
429 extp++;
430 }
--> 431 } else if (desc_size == sizeof(struct dma_edesc)) {
The dma_extended_desc and dma_edesc structs are the same size but
just the basic info is at the start vs at the end. This code is
quite old, but I think maybe we changed the Kconfig so now it's showing
up as a static checker warning?
/* Extended descriptor structure (e.g. >= databook 3.50a) */
struct dma_extended_desc {
struct dma_desc basic; /* Basic descriptors */
__le32 des4; /* Extended Status */
__le32 des5; /* Reserved */
__le32 des6; /* Tx/Rx Timestamp Low */
__le32 des7; /* Tx/Rx Timestamp High */
};
/* Enhanced descriptor for TBS */
struct dma_edesc {
__le32 des4;
__le32 des5;
__le32 des6;
__le32 des7;
struct dma_desc basic;
};
432 struct dma_edesc *ep = dma_desc_to_edesc(head);
433
434 for (i = 0; i < size; i++) {
435 dma_addr = dma_rx_phy + i * sizeof(*ep);
436 pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
437 i, &dma_addr,
438 le32_to_cpu(ep->des4), le32_to_cpu(ep->des5),
439 le32_to_cpu(ep->des6), le32_to_cpu(ep->des7),
440 le32_to_cpu(ep->basic.des0), le32_to_cpu(ep->basic.des1),
441 le32_to_cpu(ep->basic.des2), le32_to_cpu(ep->basic.des3));
442 ep++;
443 }
444 } else {
445 pr_err("unsupported descriptor!");
446 }
447 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
reply other threads:[~2026-06-23 9:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=ajpUIqyVSsWMY30x@stanley.mountain \
--to=error27@gmail.com \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=netdev@vger.kernel.org \
--cc=qiangqing.zhang@nxp.com \
/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.