lkml.org 
[lkml]   [2024]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH v4 1/6] printk: add new dev_errp_probe() helper
From: Nuno Sa <nuno.sa@analog.com>

This is similar to dev_err_probe() but for cases where an ERR_PTR() is
to be returned simplifying patterns like:

dev_err_probe(dev, ret, ...);
return ERR_PTR(ret)

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
include/linux/dev_printk.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h
index 6bfe70decc9f..64484d092a77 100644
--- a/include/linux/dev_printk.h
+++ b/include/linux/dev_printk.h
@@ -276,4 +276,9 @@ do { \

__printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);

+/* Simple helper for dev_err_probe() when ERR_PTR() is to be returned. */
+#define dev_errp_probe(dev, ___err, fmt, ...) ({ \
+ ERR_PTR(dev_err_probe(dev, ___err, fmt, ##__VA_ARGS__)); \
+})
+
#endif /* _DEVICE_PRINTK_H_ */
--
2.44.0



\
 
 \ /
  Last update: 2024-05-27 16:14    [W:1.633 / U:0.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site