treewide: fix multiple compiler warnings
[project/netifd.git] / macvlan.c
index 01a48cd9e97488bfab176ee4777e690457a553a7..c4ebdd0d9249df55d8a5c31461d71578275bb3ac 100644 (file)
--- a/macvlan.c
+++ b/macvlan.c
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
-#include <net/ethernet.h>
-
-#ifdef linux
-#include <netinet/ether.h>
-#endif
 
 #include "netifd.h"
 #include "device.h"
@@ -239,7 +234,12 @@ macvlan_create(const char *name, struct device_type *devtype,
                return NULL;
 
        dev = &mvdev->dev;
-       device_init(dev, devtype, name);
+       if (device_init(dev, devtype, name) < 0) {
+               device_cleanup(dev);
+               free(mvdev);
+               return NULL;
+       }
+
        dev->config_pending = true;
 
        mvdev->set_state = dev->set_state;
@@ -254,7 +254,7 @@ macvlan_create(const char *name, struct device_type *devtype,
 }
 
 static struct device_type macvlan_device_type = {
-       .name = "MAC VLAN",
+       .name = "macvlan",
        .config_params = &macvlan_attr_list,
        .create = macvlan_create,
        .config_init = macvlan_config_init,