All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	Srikanth Thokala <sthokal@xilinx.com>,
	Maxime COQUELIN <maxime.coquelin@st.com>
Subject: [PATCH] PCI: xilinx: fix harmless format string warning
Date: Tue, 13 Jan 2015 15:20:05 +0100	[thread overview]
Message-ID: <1759235.dcJCuiggea@wuerfel> (raw)

The xilinx pcie driver prints a register value whose type is
propagated to the type returned by the GENMASK() macro.
Unfortunately, that type has recently changed as the result
of a bug fix, so now we get a warning about the type:

drivers/pci/host/pcie-xilinx.c: In function 'xilinx_pcie_clear_err_interrupts':
drivers/pci/host/pcie-xilinx.c:154:3: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]

This changes the code so we always print the number as an
'unsigned long' type to avoid the warning. The original code
was fine on 32-bit architectures but not on 64-bit. Now it
works as expected on both.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 00b4d9a1412 ("bitops: Fix shift overflow in GENMASK macros")

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index ef3ebaf9a738..ce1c61d85b2c 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -148,10 +148,10 @@ static inline bool xilinx_pcie_link_is_up(struct xilinx_pcie_port *port)
  */
 static void xilinx_pcie_clear_err_interrupts(struct xilinx_pcie_port *port)
 {
-	u32 val = pcie_read(port, XILINX_PCIE_REG_RPEFR);
+	unsigned long val = pcie_read(port, XILINX_PCIE_REG_RPEFR);
 
 	if (val & XILINX_PCIE_RPEFR_ERR_VALID) {
-		dev_dbg(port->dev, "Requester ID %d\n",
+		dev_dbg(port->dev, "Requester ID %lu\n",
 			val & XILINX_PCIE_RPEFR_REQ_ID);
 		pcie_write(port, XILINX_PCIE_RPEFR_ALL_MASK,
 			   XILINX_PCIE_REG_RPEFR);


WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] PCI: xilinx: fix harmless format string warning
Date: Tue, 13 Jan 2015 15:20:05 +0100	[thread overview]
Message-ID: <1759235.dcJCuiggea@wuerfel> (raw)

The xilinx pcie driver prints a register value whose type is
propagated to the type returned by the GENMASK() macro.
Unfortunately, that type has recently changed as the result
of a bug fix, so now we get a warning about the type:

drivers/pci/host/pcie-xilinx.c: In function 'xilinx_pcie_clear_err_interrupts':
drivers/pci/host/pcie-xilinx.c:154:3: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]

This changes the code so we always print the number as an
'unsigned long' type to avoid the warning. The original code
was fine on 32-bit architectures but not on 64-bit. Now it
works as expected on both.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 00b4d9a1412 ("bitops: Fix shift overflow in GENMASK macros")

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index ef3ebaf9a738..ce1c61d85b2c 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -148,10 +148,10 @@ static inline bool xilinx_pcie_link_is_up(struct xilinx_pcie_port *port)
  */
 static void xilinx_pcie_clear_err_interrupts(struct xilinx_pcie_port *port)
 {
-	u32 val = pcie_read(port, XILINX_PCIE_REG_RPEFR);
+	unsigned long val = pcie_read(port, XILINX_PCIE_REG_RPEFR);
 
 	if (val & XILINX_PCIE_RPEFR_ERR_VALID) {
-		dev_dbg(port->dev, "Requester ID %d\n",
+		dev_dbg(port->dev, "Requester ID %lu\n",
 			val & XILINX_PCIE_RPEFR_REQ_ID);
 		pcie_write(port, XILINX_PCIE_RPEFR_ALL_MASK,
 			   XILINX_PCIE_REG_RPEFR);

             reply	other threads:[~2015-01-13 14:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 14:20 Arnd Bergmann [this message]
2015-01-13 14:20 ` [PATCH] PCI: xilinx: fix harmless format string warning Arnd Bergmann
2015-01-13 14:43 ` Maxime Coquelin
2015-01-13 14:43   ` Maxime Coquelin
2015-01-23 21:42 ` Bjorn Helgaas
2015-01-23 21:42   ` Bjorn Helgaas

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=1759235.dcJCuiggea@wuerfel \
    --to=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=maxime.coquelin@st.com \
    --cc=sthokal@xilinx.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.