All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, Arnd Bergmann <arnd@kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Joe Perches <joe@perches.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v2 4/4] iio: light: si1145: Drop use of %hhx format specifier.
Date: Wed, 9 Jun 2021 08:29:40 -0700	[thread overview]
Message-ID: <YMDeZMzNoxl1vGjf@Ryzen-9-3900X> (raw)
In-Reply-To: <20210603180612.3635250-5-jic23@kernel.org>

On Thu, Jun 03, 2021 at 07:06:12PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Since:
> commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
> unnecessary %h[xudi] and %hh[xudi]")
> use of these format strings has been discouraged.
> 
> As there are only a few such instances in IIO, this is part of a
> series clearing them out so they don't get copied into new drivers.
> 
> Use the 0x02x form as the length specifier when used with # includes
> the 0x prefix and is very unlikely to be what was intended by the author.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  drivers/iio/light/si1145.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
> index 3fb52402fcc3..e2abad48b9f4 100644
> --- a/drivers/iio/light/si1145.c
> +++ b/drivers/iio/light/si1145.c
> @@ -271,7 +271,7 @@ static int si1145_command(struct si1145_data *data, u8 cmd)
>  		if ((ret & ~SI1145_RSP_COUNTER_MASK) == 0) {
>  			if (ret == data->rsp_seq) {
>  				if (time_after(jiffies, stop_jiffies)) {
> -					dev_warn(dev, "timeout on command %#02hhx\n",
> +					dev_warn(dev, "timeout on command 0x%02x\n",
>  						 cmd);
>  					ret = -ETIMEDOUT;
>  					break;
> @@ -291,12 +291,12 @@ static int si1145_command(struct si1145_data *data, u8 cmd)
>  			ret = -EIO;
>  		} else {
>  			if (ret == SI1145_RSP_INVALID_SETTING) {
> -				dev_warn(dev, "INVALID_SETTING error on command %#02hhx\n",
> +				dev_warn(dev, "INVALID_SETTING error on command 0x%02x\n",
>  					 cmd);
>  				ret = -EINVAL;
>  			} else {
>  				/* All overflows are treated identically */
> -				dev_dbg(dev, "overflow, ret=%d, cmd=%#02hhx\n",
> +				dev_dbg(dev, "overflow, ret=%d, cmd=0x%02x\n",
>  					ret, cmd);
>  				ret = -EOVERFLOW;
>  			}
> @@ -1299,10 +1299,10 @@ static int si1145_probe(struct i2c_client *client,
>  						SI1145_REG_SEQ_ID);
>  	if (ret < 0)
>  		return ret;
> -	dev_info(&client->dev, "device ID part %#02hhx rev %#02hhx seq %#02hhx\n",
> +	dev_info(&client->dev, "device ID part 0x%02x rev 0x%02x seq 0x%02x\n",
>  			part_id, rev_id, seq_id);
>  	if (part_id != data->part_info->part) {
> -		dev_err(&client->dev, "part ID mismatch got %#02hhx, expected %#02x\n",
> +		dev_err(&client->dev, "part ID mismatch got 0x%02x, expected 0x%02x\n",
>  				part_id, data->part_info->part);
>  		return -ENODEV;
>  	}
> -- 
> 2.31.1

  reply	other threads:[~2021-06-09 15:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 18:06 [PATCH v2 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
2021-06-03 18:06 ` [PATCH v2 1/4] iio: si1133: fix format string warnings Jonathan Cameron
2021-06-09 15:27   ` Nathan Chancellor
2021-06-03 18:06 ` [PATCH v2 2/4] iio: light: si1133: Drop remaining uses of %hhx format string Jonathan Cameron
2021-06-09 15:27   ` Nathan Chancellor
2021-06-03 18:06 ` [PATCH v2 3/4] iio: imu: inv_mpu6050: Drop use " Jonathan Cameron
2021-06-09 15:28   ` Nathan Chancellor
2021-06-03 18:06 ` [PATCH v2 4/4] iio: light: si1145: Drop use of %hhx format specifier Jonathan Cameron
2021-06-09 15:29   ` Nathan Chancellor [this message]
2021-06-03 18:58 ` General kernel misuse of vsnprintf SPECIAL %#<foo> (was: Re: [PATCH v2 0/4] iio: Drop use of %hhx and %hx format strings) Joe Perches
2021-06-03 19:25   ` Jonathan Cameron
2021-06-03 19:34     ` Joe Perches
2021-06-04  8:27       ` Jonathan Cameron
2021-06-09 13:09 ` [PATCH v2 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
2021-06-09 17:32   ` Jonathan Cameron

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=YMDeZMzNoxl1vGjf@Ryzen-9-3900X \
    --to=nathan@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@kernel.org \
    --cc=jic23@kernel.org \
    --cc=joe@perches.com \
    --cc=linux-iio@vger.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 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.