[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240810113518.2cbceb66@jic23-huawei>
Date: Sat, 10 Aug 2024 11:35:18 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Matteo Martelli <matteomartelli3@...il.com>, Christophe JAILLET
<christophe.jaillet@...adoo.fr>, kernel-janitors@...r.kernel.org,
lars@...afoo.de, linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: pac1921: add missing error return in probe()
On Fri, 9 Aug 2024 18:18:13 +0300
Dan Carpenter <dan.carpenter@...aro.org> wrote:
> On Fri, Aug 09, 2024 at 09:31:43AM +0200, Matteo Martelli wrote:
> > Christophe JAILLET wrote:
> > > Le 08/08/2024 à 21:28, Dan Carpenter a écrit :
> > > > This error path was intended to return, and not just print an error. The
> > > > current code will lead to an error pointer dereference.
> > > >
> > > > Fixes: 371f778b83cd ("iio: adc: add support for pac1921")
> > > > Signed-off-by: Dan Carpenter <dan.carpenter-QSEj5FYQhm4dnm+yROfE0A@...lic.gmane.org>
> > > > ---
> > > > drivers/iio/adc/pac1921.c | 4 ++--
> > > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/iio/adc/pac1921.c b/drivers/iio/adc/pac1921.c
> > > > index d04c6685d780..8200a47bdf21 100644
> > > > --- a/drivers/iio/adc/pac1921.c
> > > > +++ b/drivers/iio/adc/pac1921.c
> > > > @@ -1168,8 +1168,8 @@ static int pac1921_probe(struct i2c_client *client)
> > > >
> > > > priv->regmap = devm_regmap_init_i2c(client, &pac1921_regmap_config);
> > > > if (IS_ERR(priv->regmap))
> > > > - dev_err_probe(dev, (int)PTR_ERR(priv->regmap),
> > > > - "Cannot initialize register map\n");
> > > > + return dev_err_probe(dev, (int)PTR_ERR(priv->regmap),
> > >
> > > The (int) is unusual.
> > >
> > The (int) explicit cast is to address Wconversion warnings since dev_err_probe
> > takes an int as argument.
>
> I don't want to remove the int because it's unrelated, but Christophe is right
> that the int is unusual. We really would want to discourage that.
Applied, but I'd ideally like a follow up patch removing the int and the
couple of similar instances from this driver. Anyone want to spin one?
Thanks,
Jonathan
>
> regards,
> dan carpenter
>
Powered by blists - more mailing lists