From: Ben Pfaff Date: Wed, 5 Jan 2011 18:17:17 +0000 (-0800) Subject: datapath: Fix vport_get_stats() in !VPORT_F_GEN_STATS case. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=265d5020ad6a7e1e7f97822a5545be223b6ea599;p=openvswitch datapath: Fix vport_get_stats() in !VPORT_F_GEN_STATS case. When VPORT_F_GEN_STATS was not set, vport_get_stats() would always return an error (either an error returned by ->get_stats(), otherwise -EOPNOTSUPP). This fixes the problem. Found by inspection. Signed-off-by: Ben Pfaff Acked-by: Jesse Gross --- diff --git a/datapath/vport.c b/datapath/vport.c index d7330f85..61f0e2a0 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -795,7 +795,7 @@ int vport_get_stats(struct vport *vport, struct rtnl_link_stats64 *stats) { struct rtnl_link_stats64 dev_stats; struct rtnl_link_stats64 *dev_statsp = NULL; - int err; + int err = 0; if (vport->ops->get_stats) { if (vport->ops->flags & VPORT_F_GEN_STATS) @@ -871,10 +871,7 @@ int vport_get_stats(struct vport *vport, struct rtnl_link_stats64 *stats) stats->tx_bytes += local_stats.tx_bytes; stats->tx_packets += local_stats.tx_packets; } - - err = 0; - } else - err = -EOPNOTSUPP; + } out: return err;