X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetdev.c;h=82a490419778edcd8601f60569d55f46a6d38059;hb=6ce6d3c928f26bacca60baf716b4b99a05a45ba7;hp=804050fcdc978c87ab96f1e0918d4bd9cb8297d3;hpb=49c36903d6d65bed96cba31f05534510a21a68d7;p=openvswitch diff --git a/lib/netdev.c b/lib/netdev.c index 804050fc..82a49041 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -235,6 +235,7 @@ netdev_open(const char *name, int ethertype, struct netdev **netdevp) netdev_obj = shash_find_data(&netdev_obj_shash, name); if (netdev_obj) { + netdev_obj->ref_cnt++; error = netdev_obj->netdev_class->open(name, ethertype, &netdev); } else { /* Default to "system". */ @@ -249,16 +250,14 @@ netdev_open(const char *name, int ethertype, struct netdev **netdevp) * closes its handle. */ error = class->create(name, "system", &empty_args, false); if (!error) { - error = class->open(name, ethertype, &netdev); netdev_obj = shash_find_data(&netdev_obj_shash, name); + netdev_obj->ref_cnt++; + error = class->open(name, ethertype, &netdev); } break; } } } - if (!error) { - netdev_obj->ref_cnt++; - } *netdevp = error ? NULL : netdev; return error; @@ -1055,7 +1054,7 @@ restore_flags(struct netdev *netdev) /* Retores all the flags on all network devices that we modified. Called from * a signal handler, so it does not attempt to report error conditions. */ static void -restore_all_flags(void *aux UNUSED) +restore_all_flags(void *aux OVS_UNUSED) { struct netdev *netdev; LIST_FOR_EACH (netdev, struct netdev, node, &netdev_list) {