mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-06-21 15:43:21 +02:00
3afcb36309
Add stubs for kmalloc_obj() and kmalloc_objs() to the tools/virtio test harness, matching the new kernel allocator API. Also add the DMA_ATTR_CPU_CACHE_CLEAN definition and include kernel.h from err.h for the unlikely() macro. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <a0bd4b5bed56c49626c92a754d7aceab3325de25.1780520728.git.mst@redhat.com>
29 lines
590 B
C
29 lines
590 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef ERR_H
|
|
#define ERR_H
|
|
#include <linux/kernel.h>
|
|
#define MAX_ERRNO 4095
|
|
|
|
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
|
|
|
|
static inline void * __must_check ERR_PTR(long error)
|
|
{
|
|
return (void *) error;
|
|
}
|
|
|
|
static inline long __must_check PTR_ERR(const void *ptr)
|
|
{
|
|
return (long) ptr;
|
|
}
|
|
|
|
static inline long __must_check IS_ERR(const void *ptr)
|
|
{
|
|
return IS_ERR_VALUE((unsigned long)ptr);
|
|
}
|
|
|
|
static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
|
|
{
|
|
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
|
|
}
|
|
#endif /* ERR_H */
|