]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
err.h: add INIT_ERR_PTR() macro
authorChristian Marangi <ansuelsmth@gmail.com>
Fri, 31 Oct 2025 13:08:32 +0000 (14:08 +0100)
committerBjorn Andersson <andersson@kernel.org>
Sat, 1 Nov 2025 17:44:49 +0000 (12:44 -0500)
commit652a86b24c5ac444afaf7625c9340d55aab7f105
tree25671c0855bdc8ba3ebae41325e0bd3daa92e68d
parentdc5db35073a19f6d3c30bea367b551c1a784ef8f
err.h: add INIT_ERR_PTR() macro

Add INIT_ERR_PTR() macro to initialize static variables with error
pointers. This might be useful for specific case where there is a static
variable initialized to an error condition and then later set to the
real handle once probe finish/completes.

This is to handle compilation problems like:

error: initializer element is not constant

where ERR_PTR() can't be used.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20251031130835.7953-2-ansuelsmth@gmail.com
[bjorn: Added () suffix on macro references]
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
include/linux/err.h