summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@ovn.org>2016-07-17 09:52:11 -0700
committerPravin B Shelar <pshelar@ovn.org>2016-07-17 10:25:09 -0700
commit54125dd05962cf87ef5d19729d1111c244455cf6 (patch)
tree324254075fe28496c25f2400a7ddf6b906db524f /datapath
parentf34648187b033ee9225d72b3603d9c01d0afa2fc (diff)
downloadopenvswitch-54125dd05962cf87ef5d19729d1111c244455cf6.tar.gz
datapath: use PTR_ERR_OR_ZERO
Upstream commit: commit f35423c137b0e64155f52c166db1d13834a551f2 Author: Fabian Frederick <fabf@skynet.be> openvswitch: use PTR_ERR_OR_ZERO Signed-off-by: Fabian Frederick <fabf@skynet.be> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/flow_netlink.c4
-rw-r--r--datapath/linux/compat/include/linux/err.h9
2 files changed, 10 insertions, 3 deletions
diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
index 046e60f2d..6f33926b3 100644
--- a/datapath/flow_netlink.c
+++ b/datapath/flow_netlink.c
@@ -1801,10 +1801,8 @@ int ovs_nla_add_action(struct sw_flow_actions **sfa, int attrtype, void *data,
struct nlattr *a;
a = __add_action(sfa, attrtype, data, len, log);
- if (IS_ERR(a))
- return PTR_ERR(a);
- return 0;
+ return PTR_ERR_OR_ZERO(a);
}
static inline int add_nested_action_start(struct sw_flow_actions **sfa,
diff --git a/datapath/linux/compat/include/linux/err.h b/datapath/linux/compat/include/linux/err.h
index 4a4ce7e10..321386c21 100644
--- a/datapath/linux/compat/include/linux/err.h
+++ b/datapath/linux/compat/include/linux/err.h
@@ -25,4 +25,13 @@ static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
}
#endif
+#ifndef HAVE_PTR_ERR_OR_ZERO
+static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
+{
+ if (IS_ERR(ptr))
+ return PTR_ERR(ptr);
+ else
+ return 0;
+}
+#endif
#endif