git: fbb9ca960d8d - stable/14 - LinuxKPI: Add PTR_IF macro

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Thu, 01 Aug 2024 22:27:26 UTC
The branch stable/14 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=fbb9ca960d8d0282fac3f2b31649f3cecdc5bc11

commit fbb9ca960d8d0282fac3f2b31649f3cecdc5bc11
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2024-04-08 06:47:42 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-08-01 21:09:38 +0000

    LinuxKPI: Add PTR_IF macro
    
    Sponsored by:   Serenity Cyber Security, LLC
    Reviewed by:    emaste
    MFC after:      1 week
    
    (cherry picked from commit e0eeeca8b83a17aeebc4da525e813699bf3fabc2)
---
 sys/compat/linuxkpi/common/include/linux/kernel.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 254b7729b96c..26fc2b8a4862 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -133,6 +133,8 @@ extern int linuxkpi_warn_dump_stack;
 #define	printk(...)		printf(__VA_ARGS__)
 #define	vprintk(f, a)		vprintf(f, a)
 
+#define PTR_IF(x, p)		((x) ? (p) : NULL)
+
 #define	asm			__asm
 
 extern void linux_dump_stack(void);