scst: Backport the PTR_ERR_OR_ZERO() function

Unbreak the build for the previous commit against kernel versions
before v3.12.

Fixes: ee6312ac5a ("scst_vdisk, qla2x00t-32gbit: Use PTR_ERR_OR_ZERO
instead of IS_ERR and PTR_ERR")
This commit is contained in:
Gleb Chesnokov
2022-12-27 10:53:46 +03:00
parent ee6312ac5a
commit 7dc56a07bf

View File

@@ -77,6 +77,15 @@ static __always_inline unsigned long long rdtsc(void)
#define tsc_khz 1000
#endif
/* <linux/err.h> */
/*
* See also commit 6e8b8726ad50 ("PTR_RET is now PTR_ERR_OR_ZERO") # v3.12
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_RELEASE_CODE)
#define PTR_ERR_OR_ZERO(p) PTR_RET(p)
#endif
/* <linux/bio.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \