mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 00:32:04 +02:00
linux err: make ERR_PTR/PTR_ERR architecture specific
This patch changes ERR_PTR/PTR_ERR to use CONFIG_ERR_PTR_OFFSET to map errno values into a pointer region that cannot contain valid pointers. IS_ERR and IS_ERR_OR_NULL have to be converted to use PTR_ERR, too, for this to work. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
This commit is contained in:
committed by
Tom Rini
parent
93db2b83ed
commit
8c59ca93b8
@@ -23,22 +23,22 @@
|
|||||||
|
|
||||||
static inline void *ERR_PTR(long error)
|
static inline void *ERR_PTR(long error)
|
||||||
{
|
{
|
||||||
return (void *) error;
|
return (void *)(CONFIG_ERR_PTR_OFFSET + error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long PTR_ERR(const void *ptr)
|
static inline long PTR_ERR(const void *ptr)
|
||||||
{
|
{
|
||||||
return (long) ptr;
|
return ((long)ptr - CONFIG_ERR_PTR_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long IS_ERR(const void *ptr)
|
static inline long IS_ERR(const void *ptr)
|
||||||
{
|
{
|
||||||
return IS_ERR_VALUE((unsigned long)ptr);
|
return IS_ERR_VALUE((unsigned long)PTR_ERR(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IS_ERR_OR_NULL(const void *ptr)
|
static inline bool IS_ERR_OR_NULL(const void *ptr)
|
||||||
{
|
{
|
||||||
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
|
return !ptr || IS_ERR_VALUE((unsigned long)PTR_ERR(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user