diff options
-rw-r--r-- | interface.c | 12 | ||||
-rw-r--r-- | proto-shell.c | 4 | ||||
-rw-r--r-- | vlan.c | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/interface.c b/interface.c index 6ca1d0d..b0fe9de 100644 --- a/interface.c +++ b/interface.c @@ -766,8 +766,10 @@ interface_set_l3_dev(struct interface *iface, struct device *dev) device_add_user(&iface->l3_dev, dev); if (dev) { - if (claimed) - device_claim(&iface->l3_dev); + if (claimed) { + if (device_claim(&iface->l3_dev) < 0) + return; + } interface_ip_set_enabled(&iface->config_ip, enabled); } } @@ -787,8 +789,10 @@ interface_set_main_dev(struct interface *iface, struct device *dev) return; } - if (claimed) - device_claim(&iface->l3_dev); + if (claimed) { + if (device_claim(&iface->l3_dev) < 0) + return; + } if (!iface->l3_dev.dev) interface_set_l3_dev(iface, dev); diff --git a/proto-shell.c b/proto-shell.c index c4039ed..9fad3a0 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -463,7 +463,9 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr *data, return UBUS_STATUS_INVALID_ARGUMENT; interface_set_l3_dev(iface, dev); - device_claim(&iface->l3_dev); + if (device_claim(&iface->l3_dev) < 0) + return UBUS_STATUS_UNKNOWN_ERROR; + device_set_present(dev, true); interface_update_start(iface); @@ -50,7 +50,7 @@ static int vlan_set_device_state(struct device *dev, bool up) } ret = device_claim(&vldev->dep); - if (ret) + if (ret < 0) return ret; system_vlan_add(vldev->dep.dev, vldev->id); |