if (!bp->present)
return 0;
- ret = bonding_set_active(bdev, true);
- if (ret)
- goto error;
-
/* Disable IPv6 for bonding ports */
if (!(bp->dev.dev->settings.flags & DEV_OPT_IPV6)) {
bp->dev.dev->settings.ipv6 = 0;
ret = device_claim(&bp->dev);
if (ret < 0)
- goto error;
+ return ret;
+
+ ret = bonding_set_active(bdev, true);
+ if (ret)
+ goto release;
dev = bp->dev.dev;
if (dev->settings.auth && !dev->auth_status)
bdev->n_failed++;
bp->present = false;
bdev->n_present--;
+release:
device_release(&bp->dev);
return ret;
{
struct bonding_device *bdev;
struct blob_attr *cur;
- int rem;
+ size_t rem;
bdev = container_of(dev, struct bonding_device, dev);
if ((cur = tb[BOND_ATTR_POLICY]) != NULL) {
const char *policy = blobmsg_get_string(cur);
- int i;
+ size_t i;
for (i = 0; i < ARRAY_SIZE(bonding_policy_str); i++) {
if (strcmp(policy, bonding_policy_str[i]) != 0)
struct blob_attr *tb_dev[__DEV_ATTR_MAX];
struct blob_attr *tb_b[__BOND_ATTR_MAX];
enum dev_change_type ret = DEV_CONFIG_APPLIED;
- unsigned long diff;
+ unsigned long diff[2] = {};
struct bonding_device *bdev;
- BUILD_BUG_ON(sizeof(diff) < __BOND_ATTR_MAX / 8);
+ BUILD_BUG_ON(sizeof(diff[0]) < __BOND_ATTR_MAX / 8);
BUILD_BUG_ON(sizeof(diff) < __DEV_ATTR_MAX / 8);
bdev = container_of(dev, struct bonding_device, dev);
blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, otb_dev,
blob_data(bdev->config_data), blob_len(bdev->config_data));
- diff = 0;
- uci_blob_diff(tb_dev, otb_dev, &device_attr_list, &diff);
- if (diff)
+ uci_blob_diff(tb_dev, otb_dev, &device_attr_list, diff);
+ if (diff[0] | diff[1])
ret = DEV_CONFIG_RESTART;
blobmsg_parse(bonding_attrs, __BOND_ATTR_MAX, otb_b,
blob_data(bdev->config_data), blob_len(bdev->config_data));
- diff = 0;
- uci_blob_diff(tb_b, otb_b, &bonding_attr_list, &diff);
- if (diff & ~(1 << BOND_ATTR_PORTS))
+ diff[0] = 0;
+ uci_blob_diff(tb_b, otb_b, &bonding_attr_list, diff);
+ if (diff[0] & ~(1 << BOND_ATTR_PORTS))
ret = DEV_CONFIG_RESTART;
bonding_config_init(dev);
bonding_remove_port(bp);
- device_lock();
-
device_remove_user(&bp->dev);
/*
device_set_present(dev, true);
}
- device_unlock();
-
free(bp);
}