mbox series

[RESEND,0/4] iio: Drop use of %hhx and %hx format strings

Message ID 20210517125554.1463156-1-jic23@kernel.org (mailing list archive)
Headers show
Series iio: Drop use of %hhx and %hx format strings | expand

Message

Jonathan Cameron May 17, 2021, 12:55 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Resent because for some reason this didn't reach the mailing list
(I'm not sure it reached anywhere at all!)

A wrong use of one of these in
https://lore.kernel.org/linux-iio/20210514135927.2926482-1-arnd@kernel.org/
included a reference from Nathan to a patch discouraging the use of
these strings in general:
https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/

I did a quick grep and established we only have a few instances of these in
IIO anyway, so in the interests of avoiding those existing cases getting
cut and paste into new drivers, let's just clear them out now.

Cc: Nathan Chancellor <nathan@kernel.org>
Jonathan Cameron (4):
  iio: imu: inv_mpu6050: Drop use of %hhx format string.
  iio: light: si1133: Drop remaining uses of %hhx format string.
  iio: light: si1145: Drop use of %hhx format specifier.
  iio: chemical: sgp30: Drop use of %hx in format string.

 drivers/iio/chemical/sgp30.c               |  2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |  5 ++---
 drivers/iio/light/si1133.c                 | 14 +++++++-------
 drivers/iio/light/si1145.c                 | 10 +++++-----
 4 files changed, 15 insertions(+), 16 deletions(-)

Comments

Jonathan Cameron May 22, 2021, 6:20 p.m. UTC | #1
On Mon, 17 May 2021 13:55:50 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Resent because for some reason this didn't reach the mailing list
> (I'm not sure it reached anywhere at all!)
> 
> A wrong use of one of these in
> https://lore.kernel.org/linux-iio/20210514135927.2926482-1-arnd@kernel.org/
> included a reference from Nathan to a patch discouraging the use of
> these strings in general:
> https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/
> 
> I did a quick grep and established we only have a few instances of these in
> IIO anyway, so in the interests of avoiding those existing cases getting
> cut and paste into new drivers, let's just clear them out now.

Series applied to the togreg branch of iio.git and pushed out as testing to
let 0-day poke at it before I push it out for linux-next.

Thanks,

Jonathan

> 
> Cc: Nathan Chancellor <nathan@kernel.org>
> Jonathan Cameron (4):
>   iio: imu: inv_mpu6050: Drop use of %hhx format string.
>   iio: light: si1133: Drop remaining uses of %hhx format string.
>   iio: light: si1145: Drop use of %hhx format specifier.
>   iio: chemical: sgp30: Drop use of %hx in format string.
> 
>  drivers/iio/chemical/sgp30.c               |  2 +-
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |  5 ++---
>  drivers/iio/light/si1133.c                 | 14 +++++++-------
>  drivers/iio/light/si1145.c                 | 10 +++++-----
>  4 files changed, 15 insertions(+), 16 deletions(-)
>
Jonathan Cameron June 3, 2021, 6:08 p.m. UTC | #2
On Sat, 22 May 2021 19:20:31 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Mon, 17 May 2021 13:55:50 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Resent because for some reason this didn't reach the mailing list
> > (I'm not sure it reached anywhere at all!)
> > 
> > A wrong use of one of these in
> > https://lore.kernel.org/linux-iio/20210514135927.2926482-1-arnd@kernel.org/
> > included a reference from Nathan to a patch discouraging the use of
> > these strings in general:
> > https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/
> > 
> > I did a quick grep and established we only have a few instances of these in
> > IIO anyway, so in the interests of avoiding those existing cases getting
> > cut and paste into new drivers, let's just clear them out now.  
> 
> Series applied to the togreg branch of iio.git and pushed out as testing to
> let 0-day poke at it before I push it out for linux-next.

And I dropped 3 of these, because as Joe Perches pointed out
%#02x is a very odd specifier to use as the length includes the 0x prefix
and thus might as well not be there at all.
Intention was almost certainly either
%#04x or 0x%02x  

I prefer the second one so have rerolled the first 3 of these to take that
approach. The 4th is unaffected so I have left it applied.

Thanks,

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> > 
> > Cc: Nathan Chancellor <nathan@kernel.org>
> > Jonathan Cameron (4):
> >   iio: imu: inv_mpu6050: Drop use of %hhx format string.
> >   iio: light: si1133: Drop remaining uses of %hhx format string.
> >   iio: light: si1145: Drop use of %hhx format specifier.
> >   iio: chemical: sgp30: Drop use of %hx in format string.
> > 
> >  drivers/iio/chemical/sgp30.c               |  2 +-
> >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |  5 ++---
> >  drivers/iio/light/si1133.c                 | 14 +++++++-------
> >  drivers/iio/light/si1145.c                 | 10 +++++-----
> >  4 files changed, 15 insertions(+), 16 deletions(-)
> >   
>