diff options
| author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2020-09-25 12:01:04 +0100 |
|---|---|---|
| committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2020-09-25 12:33:35 +0100 |
| commit | b09bfe80486c4d93ee1d8ae17d5b46397b1c6ee1 (patch) | |
| tree | 9622a564188513a0b33393dbe640dfd712bdb379 | |
| parent | 88adea51fb033472e996a0d2e8538360f95c16c4 (diff) | |
test fixes for sg append
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
| -rw-r--r-- | tools/testing/scatterlist/linux/mm.h | 29 | ||||
| -rw-r--r-- | tools/testing/scatterlist/main.c | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/tools/testing/scatterlist/linux/mm.h b/tools/testing/scatterlist/linux/mm.h index adadf921dcdb..6ae907f375d2 100644 --- a/tools/testing/scatterlist/linux/mm.h +++ b/tools/testing/scatterlist/linux/mm.h @@ -128,4 +128,33 @@ kmalloc_array(unsigned int n, unsigned int size, unsigned int flags) #define PageSlab(p) (0) #define flush_kernel_dcache_page(p) +#define MAX_ERRNO 4095 + +#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO) + +static inline void * __must_check ERR_PTR(long error) +{ + return (void *) error; +} + +static inline long __must_check PTR_ERR(__force const void *ptr) +{ + return (long) ptr; +} + +static inline bool __must_check IS_ERR(__force const void *ptr) +{ + return IS_ERR_VALUE((unsigned long)ptr); +} + +static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) +{ + if (IS_ERR(ptr)) + return PTR_ERR(ptr); + else + return 0; +} + +#define IS_ENABLED(x) (0) + #endif diff --git a/tools/testing/scatterlist/main.c b/tools/testing/scatterlist/main.c index 4899359a31ac..baa9cf49d2f0 100644 --- a/tools/testing/scatterlist/main.c +++ b/tools/testing/scatterlist/main.c @@ -54,7 +54,7 @@ int main(void) for (i = 0, test = tests; test->expected_segments; test++, i++) { struct page *pages[MAX_PAGES]; - struct sg_table st; + struct sg_table st = { }; struct scatterlist *sg; set_pages(pages, test->pfn, test->num_pages); |
