From: Jonathan Cameron <jic23@kernel.org>
To: Matteo Martelli <matteomartelli3@gmail.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Dan Carpenter <dan.carpenter@linaro.org>,
kernel-janitors@vger.kernel.org, lars@metafoo.de,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: pac1921: add missing error return in probe()
Date: Fri, 13 Sep 2024 20:39:50 +0100 [thread overview]
Message-ID: <20240913203950.06ed1603@jic23-huawei> (raw)
In-Reply-To: <172604712407.3581.15543200034844778072@njaxe.localdomain>
On Wed, 11 Sep 2024 11:32:04 +0200
Matteo Martelli <matteomartelli3@gmail.com> wrote:
> Quoting Jonathan Cameron (2024-08-10 12:35:18)
> > On Fri, 9 Aug 2024 18:18:13 +0300
> > Dan Carpenter <dan.carpenter@linaro.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@public.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?
> >
>
> I can spin the patch, but at this point I am wondering whether I should remove all
> the unnecessary explicit casts that I put to address Wconversion
> and Wsign-compare warnings. If that's the general approach to help readability I
> am totally fine with it.
I think it is probably sensible to do so as mostly we know the value ranges
etc so they don't matter.
Jonathan
>
> > Thanks,
> >
> > Jonathan
> >
>
> Thanks,
> Matteo Martelli
next prev parent reply other threads:[~2024-09-13 19:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 19:28 [PATCH] iio: adc: pac1921: add missing error return in probe() Dan Carpenter
2024-08-09 6:18 ` Christophe JAILLET
2024-08-09 7:31 ` Matteo Martelli
2024-08-09 8:41 ` Christophe JAILLET
2024-08-09 15:51 ` Matteo Martelli
2024-08-09 17:04 ` Matteo Martelli
2024-08-09 17:27 ` Dan Carpenter
2024-08-09 15:18 ` Dan Carpenter
2024-08-10 10:35 ` Jonathan Cameron
2024-09-11 9:32 ` Matteo Martelli
2024-09-13 19:39 ` Jonathan Cameron [this message]
2024-08-09 7:19 ` Matteo Martelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240913203950.06ed1603@jic23-huawei \
--to=jic23@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dan.carpenter@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matteomartelli3@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.