* [PATCH] i2c: sis630: correct format strings
@ 2019-03-02 14:18 Louis Taylor
2019-03-04 18:16 ` Nick Desaulniers
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Louis Taylor @ 2019-03-02 14:18 UTC (permalink / raw)
To: jdelvare
Cc: linux-i2c, linux-kernel, clang-built-linux, ndesaulniers, jflat,
Louis Taylor
When compiling with -Wformat, clang warns:
drivers/i2c/busses/i2c-sis630.c:482:4: warning: format specifies type
'unsigned short' but the argument has type 'int' [-Wformat]
smbus_base + SMB_STS,
^~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-sis630.c:483:4: warning: format specifies type
'unsigned short' but the argument has type 'int' [-Wformat]
smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-sis630.c:531:37: warning: format specifies type
'unsigned short' but the argument has type 'int' [-Wformat]
"SMBus SIS630 adapter at %04hx", smbus_base + SMB_STS);
~~~~~ ^~~~~~~~~~~~~~~~~~~~
This patch fixes the format strings to use the format type for int.
Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Louis Taylor <louis@kragniz.eu>
---
drivers/i2c/busses/i2c-sis630.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index 1e6805b5cef2..a57aa4fe51a4 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -478,7 +478,7 @@ static int sis630_setup(struct pci_dev *sis630_dev)
if (!request_region(smbus_base + SMB_STS, SIS630_SMB_IOREGION,
sis630_driver.name)) {
dev_err(&sis630_dev->dev,
- "I/O Region 0x%04hx-0x%04hx for SMBus already in use.\n",
+ "I/O Region 0x%04x-0x%04x for SMBus already in use.\n",
smbus_base + SMB_STS,
smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
retval = -EBUSY;
@@ -528,7 +528,7 @@ static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
sis630_adapter.dev.parent = &dev->dev;
snprintf(sis630_adapter.name, sizeof(sis630_adapter.name),
- "SMBus SIS630 adapter at %04hx", smbus_base + SMB_STS);
+ "SMBus SIS630 adapter at %04x", smbus_base + SMB_STS);
return i2c_add_adapter(&sis630_adapter);
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: sis630: correct format strings
2019-03-02 14:18 [PATCH] i2c: sis630: correct format strings Louis Taylor
@ 2019-03-04 18:16 ` Nick Desaulniers
2019-03-06 8:58 ` Jean Delvare
2019-03-09 9:54 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2019-03-04 18:16 UTC (permalink / raw)
To: Louis Taylor; +Cc: jdelvare, linux-i2c, LKML, clang-built-linux, Jon Flatley
On Sat, Mar 2, 2019 at 6:19 AM Louis Taylor <louis@kragniz.eu> wrote:
>
> When compiling with -Wformat, clang warns:
>
> drivers/i2c/busses/i2c-sis630.c:482:4: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> smbus_base + SMB_STS,
> ^~~~~~~~~~~~~~~~~~~~
>
> drivers/i2c/busses/i2c-sis630.c:483:4: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> drivers/i2c/busses/i2c-sis630.c:531:37: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> "SMBus SIS630 adapter at %04hx", smbus_base + SMB_STS);
> ~~~~~ ^~~~~~~~~~~~~~~~~~~~
>
> This patch fixes the format strings to use the format type for int.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@kragniz.eu>
> ---
> drivers/i2c/busses/i2c-sis630.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
> index 1e6805b5cef2..a57aa4fe51a4 100644
> --- a/drivers/i2c/busses/i2c-sis630.c
> +++ b/drivers/i2c/busses/i2c-sis630.c
> @@ -478,7 +478,7 @@ static int sis630_setup(struct pci_dev *sis630_dev)
> if (!request_region(smbus_base + SMB_STS, SIS630_SMB_IOREGION,
> sis630_driver.name)) {
> dev_err(&sis630_dev->dev,
> - "I/O Region 0x%04hx-0x%04hx for SMBus already in use.\n",
> + "I/O Region 0x%04x-0x%04x for SMBus already in use.\n",
> smbus_base + SMB_STS,
Even additions with 0x00 imply integer promotions (my least favorite part of C).
Thanks for the cleanup.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: sis630: correct format strings
2019-03-02 14:18 [PATCH] i2c: sis630: correct format strings Louis Taylor
2019-03-04 18:16 ` Nick Desaulniers
@ 2019-03-06 8:58 ` Jean Delvare
2019-03-09 9:54 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2019-03-06 8:58 UTC (permalink / raw)
To: Louis Taylor
Cc: linux-i2c, linux-kernel, clang-built-linux, ndesaulniers, jflat
Hi Louis,
On Sat, 2 Mar 2019 14:18:36 +0000, Louis Taylor wrote:
> When compiling with -Wformat, clang warns:
>
> drivers/i2c/busses/i2c-sis630.c:482:4: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> smbus_base + SMB_STS,
> ^~~~~~~~~~~~~~~~~~~~
>
> drivers/i2c/busses/i2c-sis630.c:483:4: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> drivers/i2c/busses/i2c-sis630.c:531:37: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> "SMBus SIS630 adapter at %04hx", smbus_base + SMB_STS);
> ~~~~~ ^~~~~~~~~~~~~~~~~~~~
>
> This patch fixes the format strings to use the format type for int.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@kragniz.eu>
> ---
> drivers/i2c/busses/i2c-sis630.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
> index 1e6805b5cef2..a57aa4fe51a4 100644
> --- a/drivers/i2c/busses/i2c-sis630.c
> +++ b/drivers/i2c/busses/i2c-sis630.c
> @@ -478,7 +478,7 @@ static int sis630_setup(struct pci_dev *sis630_dev)
> if (!request_region(smbus_base + SMB_STS, SIS630_SMB_IOREGION,
> sis630_driver.name)) {
> dev_err(&sis630_dev->dev,
> - "I/O Region 0x%04hx-0x%04hx for SMBus already in use.\n",
> + "I/O Region 0x%04x-0x%04x for SMBus already in use.\n",
> smbus_base + SMB_STS,
> smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
> retval = -EBUSY;
> @@ -528,7 +528,7 @@ static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
> sis630_adapter.dev.parent = &dev->dev;
>
> snprintf(sis630_adapter.name, sizeof(sis630_adapter.name),
> - "SMBus SIS630 adapter at %04hx", smbus_base + SMB_STS);
> + "SMBus SIS630 adapter at %04x", smbus_base + SMB_STS);
>
> return i2c_add_adapter(&sis630_adapter);
> }
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Would be nice if gcc itself would reports such formatting issues...
Thanks,
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: sis630: correct format strings
2019-03-02 14:18 [PATCH] i2c: sis630: correct format strings Louis Taylor
2019-03-04 18:16 ` Nick Desaulniers
2019-03-06 8:58 ` Jean Delvare
@ 2019-03-09 9:54 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2019-03-09 9:54 UTC (permalink / raw)
To: Louis Taylor
Cc: jdelvare, linux-i2c, linux-kernel, clang-built-linux,
ndesaulniers, jflat
[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]
On Sat, Mar 02, 2019 at 02:18:36PM +0000, Louis Taylor wrote:
> When compiling with -Wformat, clang warns:
>
> drivers/i2c/busses/i2c-sis630.c:482:4: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> smbus_base + SMB_STS,
> ^~~~~~~~~~~~~~~~~~~~
>
> drivers/i2c/busses/i2c-sis630.c:483:4: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> drivers/i2c/busses/i2c-sis630.c:531:37: warning: format specifies type
> 'unsigned short' but the argument has type 'int' [-Wformat]
> "SMBus SIS630 adapter at %04hx", smbus_base + SMB_STS);
> ~~~~~ ^~~~~~~~~~~~~~~~~~~~
>
> This patch fixes the format strings to use the format type for int.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@kragniz.eu>
Changed Jean's SoB to Rev-by and applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-09 9:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-02 14:18 [PATCH] i2c: sis630: correct format strings Louis Taylor
2019-03-04 18:16 ` Nick Desaulniers
2019-03-06 8:58 ` Jean Delvare
2019-03-09 9:54 ` Wolfram Sang
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.