Message ID | df440b36aee29cc14c21a3153983c7dfaaf7172a.1584897364.git.nish.malpani25@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Use vsprintf extension %pe for symbolic error | expand |
On Sun, 22 Mar 2020 22:53:10 +0530 Nishant Malpani <nish.malpani25@gmail.com> wrote: > Utilize %pe format specifier from vsprintf while printing error logs > with dev_err(). Discards the use of unnecessary explicit casting and > prints symbolic error name which might prove to be convenient during > debugging. > > Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Applied, Thanks, Jonathan > --- > > Changes in v2: > - Rewrite commit subject line outlining the usage of %pe. > - Add a separator between regmap and its error name. > > Based on conversations in [1] & [2]. > > [1] https://marc.info/?l=linux-iio&m=158427554607223&w=2 > [2] https://marc.info/?l=linux-iio&m=158481647605891&w=2 > --- > drivers/iio/imu/bmi160/bmi160_spi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/imu/bmi160/bmi160_spi.c b/drivers/iio/imu/bmi160/bmi160_spi.c > index c19e3df35559..61389b41c6d9 100644 > --- a/drivers/iio/imu/bmi160/bmi160_spi.c > +++ b/drivers/iio/imu/bmi160/bmi160_spi.c > @@ -20,8 +20,8 @@ static int bmi160_spi_probe(struct spi_device *spi) > > regmap = devm_regmap_init_spi(spi, &bmi160_regmap_config); > if (IS_ERR(regmap)) { > - dev_err(&spi->dev, "Failed to register spi regmap %d\n", > - (int)PTR_ERR(regmap)); > + dev_err(&spi->dev, "Failed to register spi regmap: %pe\n", > + regmap); > return PTR_ERR(regmap); > } > return bmi160_core_probe(&spi->dev, regmap, id->name, true);
diff --git a/drivers/iio/imu/bmi160/bmi160_spi.c b/drivers/iio/imu/bmi160/bmi160_spi.c index c19e3df35559..61389b41c6d9 100644 --- a/drivers/iio/imu/bmi160/bmi160_spi.c +++ b/drivers/iio/imu/bmi160/bmi160_spi.c @@ -20,8 +20,8 @@ static int bmi160_spi_probe(struct spi_device *spi) regmap = devm_regmap_init_spi(spi, &bmi160_regmap_config); if (IS_ERR(regmap)) { - dev_err(&spi->dev, "Failed to register spi regmap %d\n", - (int)PTR_ERR(regmap)); + dev_err(&spi->dev, "Failed to register spi regmap: %pe\n", + regmap); return PTR_ERR(regmap); } return bmi160_core_probe(&spi->dev, regmap, id->name, true);
Utilize %pe format specifier from vsprintf while printing error logs with dev_err(). Discards the use of unnecessary explicit casting and prints symbolic error name which might prove to be convenient during debugging. Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> --- Changes in v2: - Rewrite commit subject line outlining the usage of %pe. - Add a separator between regmap and its error name. Based on conversations in [1] & [2]. [1] https://marc.info/?l=linux-iio&m=158427554607223&w=2 [2] https://marc.info/?l=linux-iio&m=158481647605891&w=2 --- drivers/iio/imu/bmi160/bmi160_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)