Re: [PATCH 10/32] media: i2c: imx335: Use %pe format specifier

From: Kieran Bingham

Date: Mon Oct 13 2025 - 11:06:13 EST


Quoting Kieran Bingham (2025-10-13 16:03:23)
> Quoting Ricardo Ribalda (2025-10-13 15:14:50)
> > 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/imx335.c:1013:3-10: WARNING: Consider using %pe to print PTR_ERR()
>
> Ohhh nice. Is this new ? First I've come across it.
>
>
>
> > Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> > ---
> > drivers/media/i2c/imx335.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c
> > index c043df2f15fb25b3a56422092f99a1fd9a508fa9..71ed9a0d84a252ee362621c4d38001508fb86d28 100644
> > --- a/drivers/media/i2c/imx335.c
> > +++ b/drivers/media/i2c/imx335.c
> > @@ -1009,8 +1009,8 @@ static int imx335_parse_hw_config(struct imx335 *imx335)
> > imx335->reset_gpio = devm_gpiod_get_optional(imx335->dev, "reset",
> > GPIOD_OUT_HIGH);
> > if (IS_ERR(imx335->reset_gpio)) {
> > - dev_err(imx335->dev, "failed to get reset gpio %ld\n",
> > - PTR_ERR(imx335->reset_gpio));
> > + dev_err(imx335->dev, "failed to get reset gpio %pe\n",
> > + imx335->reset_gpio);
>
> Reviewed-by: Kieran Bingham <kieran.bingham@xxxxxxxxxxxxxxxx>
>

I see imx335->inclk is checked with PTR_ERR below too - but isn't
currently printed, so I think it's out of scope for this series - but
probably worth using the new helper to report that failure too in the
future.

I'll see if there's some error handling clean up to be done on top
later.

> > return PTR_ERR(imx335->reset_gpio);
> > }
> >
> >
> > --
> > 2.51.0.760.g7b8bcc2412-goog
> >