summaryrefslogtreecommitdiffhomepage
path: root/proto.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-01-24 22:39:11 +0100
committerFelix Fietkau <nbd@openwrt.org>2012-01-24 22:39:11 +0100
commit79368a64dbeba1bde4e03222ae82c1b22d66b37d (patch)
tree8345c7520612c75b84c9648d673df5b02f55f9a2 /proto.c
parentc6b739e28f2b15789c95dd28af3f193ec8f67531 (diff)
make sure iface->proto_handler is always initialized
Diffstat (limited to 'proto.c')
-rw-r--r--proto.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/proto.c b/proto.c
index c51637f..1a260cc 100644
--- a/proto.c
+++ b/proto.c
@@ -176,17 +176,14 @@ proto_init_interface(struct interface *iface, struct blob_attr *attr)
void
proto_attach_interface(struct interface *iface, const char *proto_name)
{
- const struct proto_handler *proto = NULL;
-
- if (!proto_name) {
- interface_add_error(iface, "proto", "NO_PROTO", NULL, 0);
- return;
- }
-
- proto = get_proto_handler(proto_name);
- if (!proto) {
- interface_add_error(iface, "proto", "INVALID_PROTO", NULL, 0);
- proto = &no_proto;
+ const struct proto_handler *proto = &no_proto;
+
+ if (proto_name) {
+ proto = get_proto_handler(proto_name);
+ if (!proto) {
+ interface_add_error(iface, "proto", "INVALID_PROTO", NULL, 0);
+ proto = &no_proto;
+ }
}
iface->proto_handler = proto;