Skip to contentSkip to conversation

device property: Remove duplicate test for NULL

PATCH Applied Andy Shevchenko 3 participants 3 messages Aug 23, 2019 – Aug 28, 2019

Subsystems (3)
lore
Share & tools
lore

Andy Shevchenko

author reviewer
#0 lore raw

PATCH 1/1 device property: Remove duplicate test for NULL

There is no need to check twice for a NULL in fwnode_call_bool_op().

---
 include/linux/fwnode.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
include/linux/fwnode.h +5 -4
index a11c8c56c78b..ababd6bc82f3 100644
@@ -110,10 +110,11 @@ struct fwnode_operations {
 	(fwnode ? (fwnode_has_op(fwnode, op) ?				\
 		   (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \
 	 -EINVAL)
-#define fwnode_call_bool_op(fwnode, op, ...)				\
-	(fwnode ? (fwnode_has_op(fwnode, op) ?				\
-		   (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : false) : \
-	 false)
+
+#define fwnode_call_bool_op(fwnode, op, ...)		\
+	(fwnode_has_op(fwnode, op) ?			\
+	 (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : false)
+
 #define fwnode_call_ptr_op(fwnode, op, ...)		\
 	(fwnode_has_op(fwnode, op) ?			\
 	 (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : NULL)
Signature · 1 line
2.23.0.rc1
#2 lore raw
In reply to Andy Shevchenko
Quoted 19 lines · CEST Andy Shevchenko

There is no need to check twice for a NULL in fwnode_call_bool_op().

---
 include/linux/fwnode.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
include/linux/fwnode.h +0 -2
index a11c8c56c78b..ababd6bc82f3 100644
@@ -110,10 +110,11 @@ struct fwnode_operations {
 	(fwnode ? (fwnode_has_op(fwnode, op) ?				\
 		   (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \
 	 -EINVAL)
-#define fwnode_call_bool_op(fwnode, op, ...)				\
-	(fwnode ? (fwnode_has_op(fwnode, op) ?				\

include/linux/fwnode.h struct fwnode_operations { · line 120

Quoted 10 lines
include/linux/fwnode.h +5 -2
-		   (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : false) : \
-	 false)
+
+#define fwnode_call_bool_op(fwnode, op, ...)		\
+	(fwnode_has_op(fwnode, op) ?			\
+	 (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : false)
+
 #define fwnode_call_ptr_op(fwnode, op, ...)		\
 	(fwnode_has_op(fwnode, op) ?			\
 	 (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : NULL)

Applied, thanks!