summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2010-12-13 15:21:28 -0800
committerJesse Gross <jesse@nicira.com>2010-12-13 16:08:23 -0800
commit94947cd83a796c4bf5a77fdf488662d0a0681c18 (patch)
tree981747029c6fd1d045db72614bbf2dfcfd493b1c
parent39376d06ffe60b4352e7d1a6f0a8d3b662d9aa39 (diff)
downloadopenvswitch-94947cd83a796c4bf5a77fdf488662d0a0681c18.tar.gz
datapath: Correctly return error if percpu allocation fails.
If the allocation of percpu stats fails when creating a new datapath, we currently don't return the correct error code. Since we don't explicitly set it when the allocation fails it will keep the value from the previous call. This means we will return success when the creation actually failed. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--datapath/datapath.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 0205fd267..fded95ce1 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -270,8 +270,10 @@ static int create_dp(int dp_idx, const char __user *devnamep)
dp->drop_frags = 0;
dp->stats_percpu = alloc_percpu(struct dp_stats_percpu);
- if (!dp->stats_percpu)
+ if (!dp->stats_percpu) {
+ err = -ENOMEM;
goto err_destroy_local_port;
+ }
rcu_assign_pointer(dps[dp_idx], dp);
dp_sysfs_add_dp(dp);