From: Niklas Cassel <cassel@kernel.org>
To: "Jingoo Han" <jingoohan1@gmail.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>
Cc: Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>,
linux-pci@vger.kernel.org
Subject: [PATCH v2] PCI: dwc: Fix W=1 build warning in dw_pcie_edma_irq_verify()
Date: Thu, 2 Jan 2025 12:13:40 +0100 [thread overview]
Message-ID: <20250102111339.2233101-2-cassel@kernel.org> (raw)
Change dw_pcie_edma_irq_verify() to print the dma channel as %u.
While a DWC glue driver could theoretically initialize nr_irqs to a
negative value, doing so would obviously be incorrect, and the later
dw_edma_probe(struct dw_edma_chip *chip) call would fail, since while
the dw_edma_probe() call expects the caller to initialize chip->nr_irqs,
dw_edma_probe() verifies nr_irqs and returns failure if nr_irqs is < 1.
This fixes the following build warning when compiling with W=1:
drivers/pci/controller/dwc/pcie-designware.c: In function ‘dw_pcie_edma_detect’:
drivers/pci/controller/dwc/pcie-designware.c:989:50: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 3 [-Wformat-truncation=]
989 | snprintf(name, sizeof(name), "dma%d", pci->edma.nr_irqs);
| ^~
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
Changes since V1:
-Do not reject negative nr_irqs value in dw_pcie_edma_irq_verify(),
as this will already be done by dw_edma_probe().
drivers/pci/controller/dwc/pcie-designware.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index 3c683b6119c3..0a13fb4336f4 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -986,7 +986,7 @@ static int dw_pcie_edma_irq_verify(struct dw_pcie *pci)
}
for (; pci->edma.nr_irqs < ch_cnt; pci->edma.nr_irqs++) {
- snprintf(name, sizeof(name), "dma%d", pci->edma.nr_irqs);
+ snprintf(name, sizeof(name), "dma%u", pci->edma.nr_irqs);
ret = platform_get_irq_byname_optional(pdev, name);
if (ret <= 0)
--
2.47.1
next reply other threads:[~2025-01-02 11:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 11:13 Niklas Cassel [this message]
2025-01-03 22:10 ` [PATCH v2] PCI: dwc: Fix W=1 build warning in dw_pcie_edma_irq_verify() Bjorn Helgaas
2025-01-04 0:19 ` Niklas Cassel
2025-01-04 4:11 ` Manivannan Sadhasivam
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=20250102111339.2233101-2-cassel@kernel.org \
--to=cassel@kernel.org \
--cc=bhelgaas@google.com \
--cc=dlemoal@kernel.org \
--cc=jingoohan1@gmail.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh@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