[PATCH 05/32] media: ar0521: Use %pe format specifier

Ricardo Ribalda posted 32 patches 2 months, 1 week ago
Only 31 patches received!
[PATCH 05/32] media: ar0521: Use %pe format specifier
Posted by Ricardo Ribalda 2 months, 1 week ago
The %pe format specifier is designed to print error pointers. It prints
a symbolic error name (eg. -EINVAL) and it makes the code simpler by
omitting PTR_ERR()

This patch fixes this cocci report:
./i2c/ar0521.c:1113:31-38: WARNING: Consider using %pe to print PTR_ERR()

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/i2c/ar0521.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c
index 939bf590d4b2107c6669b83903028744de1c2b30..f156058500e3dce5d7b5b831bf8ec4056e49ad5b 100644
--- a/drivers/media/i2c/ar0521.c
+++ b/drivers/media/i2c/ar0521.c
@@ -1109,8 +1109,8 @@ static int ar0521_probe(struct i2c_client *client)
 						ar0521_supply_names[cnt]);
 
 		if (IS_ERR(supply)) {
-			dev_info(dev, "no %s regulator found: %li\n",
-				 ar0521_supply_names[cnt], PTR_ERR(supply));
+			dev_info(dev, "no %s regulator found: %pe\n",
+				 ar0521_supply_names[cnt], supply);
 			return PTR_ERR(supply);
 		}
 		sensor->supplies[cnt] = supply;

-- 
2.51.0.760.g7b8bcc2412-goog
Re: [PATCH 05/32] media: ar0521: Use %pe format specifier
Posted by Krzysztof Hałasa 2 months ago
Ricardo Ribalda <ribalda@chromium.org> writes:

> The %pe format specifier is designed to print error pointers. It prints
> a symbolic error name (eg. -EINVAL) and it makes the code simpler by
> omitting PTR_ERR()
>
> This patch fixes this cocci report:
> ./i2c/ar0521.c:1113:31-38: WARNING: Consider using %pe to print PTR_ERR()
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Thanks,
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>

> --- a/drivers/media/i2c/ar0521.c
> +++ b/drivers/media/i2c/ar0521.c
> @@ -1109,8 +1109,8 @@ static int ar0521_probe(struct i2c_client *client)
>                                                 ar0521_supply_names[cnt]);
>
>                 if (IS_ERR(supply)) {
> -                       dev_info(dev, "no %s regulator found: %li\n",
> -                                ar0521_supply_names[cnt], PTR_ERR(supply));
> +                       dev_info(dev, "no %s regulator found: %pe\n",
> +                                ar0521_supply_names[cnt], supply);
>                         return PTR_ERR(supply);
>                 }
>                 sensor->supplies[cnt] = supply;

-- 
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa