diff mbox

[v6,12/15] tty: serial: 8250: Correct conversion specifiers

Message ID 1452720561-28443-13-git-send-email-anton.wuerfel@fau.de (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

Anton Wuerfel Jan. 13, 2016, 9:29 p.m. UTC
This patch fixes compiler warnings about wrong conversion specifiers used
in a debug output in 8250_pnp.c. The precise warning is:

drivers/tty/serial/8250/8250_pnp.c: In function ‘serial_pnp_probe’:
include/linux/dynamic_debug.h:64:16: warning: format ‘%x’ expects argument
of [...]

include/linux/dynamic_debug.h:84:2: note: in expansion of macro
‘DEFINE_DYNAMIC_DEBUG_METADATA’

include/linux/device.h:1179:2: note: in expansion of macro
‘dynamic_dev_dbg’

drivers/tty/serial/8250/8250_pnp.c:467:2: note: in expansion of macro
‘dev_dbg’
  dev_dbg(&dev->dev,
  ^
include/linux/dynamic_debug.h:64:16: warning: format ‘%lx’ expects argument
of [...]

include/linux/dynamic_debug.h:84:2: note: in expansion of macro
‘DEFINE_DYNAMIC_DEBUG_METADATA’

include/linux/device.h:1179:2: note: in expansion of macro
‘dynamic_dev_dbg’

drivers/tty/serial/8250/8250_pnp.c:467:2: note: in expansion of macro
‘dev_dbg’
  dev_dbg(&dev->dev,
  ^

Those warnings never got triggered, because the command was nested
in an #ifdef, which is removed by a patch of this series.

Signed-off-by: Anton Würfel <anton.wuerfel@fau.de>
Signed-off-by: Phillip Raffeck <phillip.raffeck@fau.de>
Cc: linux-kernel@i4.cs.fau.de
---
 drivers/tty/serial/8250/8250_pnp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko Jan. 14, 2016, 9:31 a.m. UTC | #1
On Wed, 2016-01-13 at 22:29 +0100, Anton Wuerfel wrote:
> This patch fixes compiler warnings about wrong conversion specifiers 

This patch obviously doesn't _fix_warnings_, rather changes specifiers
to get it consistent with argument.

> used
> in a debug output in 8250_pnp.c. The precise warning is:

Usually there is no need to cite all lines…

> 
> drivers/tty/serial/8250/8250_pnp.c: In function ‘serial_pnp_probe’:
> include/linux/dynamic_debug.h:64:16: warning: format ‘%x’ expects
> argument
> of [...]

OK.

> 
> include/linux/dynamic_debug.h:84:2: note: in expansion of macro
> ‘DEFINE_DYNAMIC_DEBUG_METADATA’
> 
> include/linux/device.h:1179:2: note: in expansion of macro
> ‘dynamic_dev_dbg’

Redundant.

> 
> drivers/tty/serial/8250/8250_pnp.c:467:2: note: in expansion of macro
> ‘dev_dbg’
>   dev_dbg(&dev->dev,
>   ^
> include/linux/dynamic_debug.h:64:16: warning: format ‘%lx’ expects
> argument
> of [...]

OK.

> 
> include/linux/dynamic_debug.h:84:2: note: in expansion of macro
> ‘DEFINE_DYNAMIC_DEBUG_METADATA’
> 
> include/linux/device.h:1179:2: note: in expansion of macro
> ‘dynamic_dev_dbg’

Redundant.

> 
> drivers/tty/serial/8250/8250_pnp.c:467:2: note: in expansion of macro
> ‘dev_dbg’
>   dev_dbg(&dev->dev,
>   ^
> 
> Those warnings never got triggered, because the command was nested
> in an #ifdef, which is removed by a patch of this series.
> 
> Signed-off-by: Anton Würfel <anton.wuerfel@fau.de>
> Signed-off-by: Phillip Raffeck <phillip.raffeck@fau.de>
> Cc: linux-kernel@i4.cs.fau.de
> ---
>  drivers/tty/serial/8250/8250_pnp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_pnp.c
> b/drivers/tty/serial/8250/8250_pnp.c
> index 0c32c59..92f4412 100644
> --- a/drivers/tty/serial/8250/8250_pnp.c
> +++ b/drivers/tty/serial/8250/8250_pnp.c
> @@ -465,8 +465,8 @@ serial_pnp_probe(struct pnp_dev *dev, const
> struct pnp_device_id *dev_id)
>  		return -ENODEV;
>  
>  	dev_dbg(&dev->dev,
> -		 "Setup PNP port: port %x, mem 0x%lx, irq %d, type
> %d\n",
> -		 uart.port.iobase, uart.port.mapbase,
> +		 "Setup PNP port: port %lx, mem 0x%lx, irq %d, type
> %d\n",
> +		 uart.port.iobase, (unsigned long)uart.port.mapbase,

This approach is not fully correct. In Linux kernel we have %p
extensions to cover some custom types such as resource_size_t, of which
mapbase is.

Thus,

"Setup PNP port: port %lx, mem %pa, irq %d, type %d\n",
uart.port.iobase, &uart.port.mapbase,

looks better.

>  		 uart.port.irq, uart.port.iotype);
>  
>  	if (flags & CIR_PORT) {
diff mbox

Patch

diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 0c32c59..92f4412 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -465,8 +465,8 @@  serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 		return -ENODEV;
 
 	dev_dbg(&dev->dev,
-		 "Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n",
-		 uart.port.iobase, uart.port.mapbase,
+		 "Setup PNP port: port %lx, mem 0x%lx, irq %d, type %d\n",
+		 uart.port.iobase, (unsigned long)uart.port.mapbase,
 		 uart.port.irq, uart.port.iotype);
 
 	if (flags & CIR_PORT) {