[PATCH 03/18] [RFC] at91: Make IS_ERR work for I/O pointers
Sascha Hauer
s.hauer at pengutronix.de
Wed Feb 17 00:34:24 PST 2016
On Tue, Feb 16, 2016 at 05:29:04PM -0800, Andrey Smirnov wrote:
> Having this functionality partially "broken" opens the door for subtle
> bugs in peripheral drivers for AT91 platform since it not straight out
> obvious that IS_ERR might return a false positive.
>
> It also makes it much harder to judge the correctness of the driver
> code, for example it is perfectly fine to use IS_ERR in at91-i2c.c since
> I2C controller's register file is located at 0xFFFA_C000 (which it
> doesn't but that's the subject for another patch), however one couldn't
> help but wonder how the code it sam9_smc.c could possibly work given how
> that module is located at 0xFFFF_EC00.
0x100000000 - MAX_ERRNO is still bigger than 0xFFFFEC00, so this should
work.
The workaround you suggest is sooo ugly, do we really need this? How
many places are really affected by false positives in IS_ERR_VALUE?
Another solution, although a job for someone familiar with coccinelle
would be to change the prototype of dev_request_mem_region to
int dev_request_mem_region(struct device_d *dev, int num, void __iomem **base);
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list