[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181014202457.dohwgz3frgcpdpy6@pengutronix.de>
Date: Sun, 14 Oct 2018 22:24:57 +0200
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Vokáč Michal <Michal.Vokac@...ft.com>
Cc: Mark Rutland <mark.rutland@....com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>,
Lukasz Majewski <l.majewski@...ess.pl>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Rob Herring <robh+dt@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
Fabio Estevam <fabio.estevam@....com>,
Lothar Waßmann <LW@...o-electronics.de>
Subject: Re: [RCF PATCH,v2,2/2] pwm:
imx: Configure output to GPIO in disabled state
Hello,
On Fri, Oct 12, 2018 at 06:08:54PM +0200, Uwe Kleine-König wrote:
> > >> + if (PTR_ERR(imx_chip->pwm_gpiod) == -EPROBE_DEFER) {
> > >
> > > You must not use PTR_ERR on a value that might not contain an error
> > > pointer.
> >
> > OK, thank you for valuable info.
> > So it seems like the I2C folks are in troubles as well:
> >
> > https://elixir.bootlin.com/linux/latest/source/drivers/i2c/busses/i2c-imx.c#L996
>
> correct. I cannot find this documented though.
I found in LDD3[1], chapter 11 on page 295:
If you need the actual error code, it can be extracted with:
long PTR_ERR(const void *ptr);
You should use PTR_ERR only on a value for which IS_ERR returns a true
value; any other value is a valid pointer.
That is probably where I have my claim from. There is no further
explanation though, so I'll post a patch adding a comment to the
definition of PTR_ERR to find out if there is a relevant reason.
Best regards
Uwe
[1] https://lwn.net/Kernel/LDD3/
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Powered by blists - more mailing lists