Re: [RCF PATCH,v2,2/2] pwm: imx: Configure output to GPIO in disabled state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/  |



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux