[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7afc367b-8103-9d48-1bfe-d505d86553b9@kernel.org>
Date: Fri, 14 May 2021 10:45:02 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Arnd Bergmann <arnd@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Maxime Roussin-BĂ©langer
<maxime.roussinbelanger@...il.com>,
Jean-Francois Dagenais <jeff.dagenais@...il.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Lars-Peter Clausen <lars@...afoo.de>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
clang-built-linux@...glegroups.com
Subject: Re: [PATCH] iio: si1133: fix format string warnings
On 5/14/2021 6:59 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> clang complains about multiple instances of printing an integer
> using the %hhx format string:
>
> drivers/iio/light/si1133.c:982:4: error: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Werror,-Wformat]
> part_id, rev_id, mfr_id);
> ^~~~~~~
>
> Print them as a normal integer instead, leaving the "#02"
> length modifier.
>
> Fixes: e01e7eaf37d8 ("iio: light: introduce si1133")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Indeed, use of %hx and %hhx have been discouraged since commit
cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary
%h[xudi] and %hh[xudi]").
Reviewed-by: Nathan Chancellor <nathan@...nel.org>
> ---
> drivers/iio/light/si1133.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
> index c280b4195003..fd302480262b 100644
> --- a/drivers/iio/light/si1133.c
> +++ b/drivers/iio/light/si1133.c
> @@ -978,11 +978,11 @@ static int si1133_validate_ids(struct iio_dev *iio_dev)
> return err;
>
> dev_info(&iio_dev->dev,
> - "Device ID part %#02hhx rev %#02hhx mfr %#02hhx\n",
> + "Device ID part %#02x rev %#02x mfr %#02x\n",
> part_id, rev_id, mfr_id);
> if (part_id != SI1133_PART_ID) {
> dev_err(&iio_dev->dev,
> - "Part ID mismatch got %#02hhx, expected %#02x\n",
> + "Part ID mismatch got %#02x, expected %#02x\n",
> part_id, SI1133_PART_ID);
> return -ENODEV;
> }
>
Powered by blists - more mailing lists