summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-11-10 14:41:35 +0100
committerTom Gundersen <teg@jklm.no>2015-11-10 14:41:35 +0100
commit76fba3ca608931e0f5a43e01039297d6e38be2c2 (patch)
tree54cb5fbcf017a075eee9cf6d347d7c93de274f26 /src
parentb18fc75b07609dab1b87b964b06131a8417910b4 (diff)
parent9ac8e913246d603c612b6083beac5a5ef7e307b2 (diff)
Merge pull request #1735 from thom311/master
lldp: avoid compiler warnings in lldp_tfl_package_read* functions
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/lldp-tlv.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/libsystemd-network/lldp-tlv.c b/src/libsystemd-network/lldp-tlv.c
index a539b5dfea..7890160497 100644
--- a/src/libsystemd-network/lldp-tlv.c
+++ b/src/libsystemd-network/lldp-tlv.c
@@ -387,12 +387,11 @@ static int lldp_tlv_packet_read_u16_tlv(tlv_packet *tlv, uint16_t type, uint16_t
r = lldp_tlv_packet_enter_container(tlv, type);
if (r < 0)
- goto out;
+ return r;
r = tlv_packet_read_u16(tlv, value);
r2 = lldp_tlv_packet_exit_container(tlv);
- out:
return r < 0 ? r : r2;
}
@@ -429,18 +428,18 @@ int sd_lldp_packet_read_chassis_id(tlv_packet *tlv,
r = lldp_tlv_packet_enter_container(tlv, LLDP_TYPE_CHASSIS_ID);
if (r < 0)
- goto out2;
+ return r;
r = tlv_packet_read_u8(tlv, &subtype);
if (r < 0)
- goto out1;
+ goto out;
switch (subtype) {
case LLDP_CHASSIS_SUBTYPE_MAC_ADDRESS:
r = tlv_packet_read_bytes(tlv, data, length);
if (r < 0)
- goto out1;
+ goto out;
break;
default:
@@ -450,10 +449,9 @@ int sd_lldp_packet_read_chassis_id(tlv_packet *tlv,
*type = subtype;
- out1:
+ out:
r2 = lldp_tlv_packet_exit_container(tlv);
- out2:
return r < 0 ? r : r2;
}
@@ -469,11 +467,11 @@ int sd_lldp_packet_read_port_id(tlv_packet *tlv,
r = lldp_tlv_packet_enter_container(tlv, LLDP_TYPE_PORT_ID);
if (r < 0)
- goto out2;
+ return r;
r = tlv_packet_read_u8(tlv, &subtype);
if (r < 0)
- goto out1;
+ goto out;
switch (subtype) {
case LLDP_PORT_SUBTYPE_PORT_COMPONENT:
@@ -483,7 +481,7 @@ int sd_lldp_packet_read_port_id(tlv_packet *tlv,
r = tlv_packet_read_string(tlv, &s, length);
if (r < 0)
- goto out1;
+ goto out;
*data = (uint8_t *) s;
@@ -492,7 +490,7 @@ int sd_lldp_packet_read_port_id(tlv_packet *tlv,
r = tlv_packet_read_bytes(tlv, data, length);
if (r < 0)
- goto out1;
+ goto out;
break;
default:
@@ -502,10 +500,9 @@ int sd_lldp_packet_read_port_id(tlv_packet *tlv,
*type = subtype;
- out1:
+ out:
r2 = lldp_tlv_packet_exit_container(tlv);
- out2:
return r < 0 ? r : r2;
}
@@ -542,12 +539,11 @@ int sd_lldp_packet_read_port_vlan_id(tlv_packet *tlv, uint16_t *id) {
r = lldp_tlv_packet_enter_container_oui(tlv, LLDP_OUI_802_1, LLDP_OUI_SUBTYPE_802_1_PORT_VLAN_ID);
if (r < 0)
- goto out;
+ return r;
r = tlv_packet_read_u16(tlv, id);
r2 = lldp_tlv_packet_exit_container(tlv);
- out:
return r < 0 ? r : r2;
}
@@ -558,7 +554,7 @@ int sd_lldp_packet_read_port_protocol_vlan_id(sd_lldp_packet *tlv, uint8_t *flag
r = lldp_tlv_packet_enter_container_oui(tlv, LLDP_OUI_802_1, LLDP_OUI_SUBTYPE_802_1_PORT_PROTOCOL_VLAN_ID);
if (r < 0)
- goto out;
+ return r;
r = tlv_packet_read_u8(tlv, flags);
if (r >= 0)
@@ -566,7 +562,6 @@ int sd_lldp_packet_read_port_protocol_vlan_id(sd_lldp_packet *tlv, uint8_t *flag
r2 = lldp_tlv_packet_exit_container(tlv);
- out:
return r < 0 ? r : r2;
}
@@ -578,7 +573,7 @@ int sd_lldp_packet_read_vlan_name(tlv_packet *tlv, uint16_t *vlan_id, char **nam
r = lldp_tlv_packet_enter_container_oui(tlv, LLDP_OUI_802_1, LLDP_OUI_SUBTYPE_802_1_VLAN_NAME);
if (r < 0)
- goto out;
+ return r;
r = tlv_packet_read_u16(tlv, vlan_id);
if (r >= 0)
@@ -591,7 +586,6 @@ int sd_lldp_packet_read_vlan_name(tlv_packet *tlv, uint16_t *vlan_id, char **nam
r2 = lldp_tlv_packet_exit_container(tlv);
- out:
return r < 0 ? r : r2;
}
@@ -602,12 +596,11 @@ int sd_lldp_packet_read_management_vid(tlv_packet *tlv, uint16_t *id) {
r = lldp_tlv_packet_enter_container_oui(tlv, LLDP_OUI_802_1, LLDP_OUI_SUBTYPE_802_1_MANAGEMENT_VID);
if (r < 0)
- goto out;
+ return r;
r = tlv_packet_read_u16(tlv, id);
r2 = lldp_tlv_packet_exit_container(tlv);
- out:
return r < 0 ? r : r2;
}
@@ -618,7 +611,7 @@ int sd_lldp_packet_read_link_aggregation(sd_lldp_packet *tlv, uint8_t *status, u
r = lldp_tlv_packet_enter_container_oui(tlv, LLDP_OUI_802_1, LLDP_OUI_SUBTYPE_802_1_LINK_AGGREGATION);
if (r < 0)
- goto out;
+ return r;
r = tlv_packet_read_u8(tlv, status);
if (r >= 0)
@@ -626,7 +619,6 @@ int sd_lldp_packet_read_link_aggregation(sd_lldp_packet *tlv, uint8_t *status, u
r2 = lldp_tlv_packet_exit_container(tlv);
- out:
return r < 0 ? r : r2;
}