]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-sriov.c
tree-wide: use UINT64_MAX or friends
[thirdparty/systemd.git] / src / network / networkd-sriov.c
index 92c00d79e039f93c3d86393d58c6ef63771461ce..7a76b61c4aefec0384bb1b92500564b0717eb4df 100644 (file)
@@ -17,7 +17,7 @@ static int sr_iov_new(SRIOV **ret) {
                 return -ENOMEM;
 
         *sr_iov = (SRIOV) {
-                  .vf = (uint32_t) -1,
+                  .vf = UINT32_MAX,
                   .vlan_proto = ETH_P_8021Q,
                   .vf_spoof_check_setting = -1,
                   .trust = -1,
@@ -58,11 +58,7 @@ static int sr_iov_new_static(Network *network, const char *filename, unsigned se
         sr_iov->network = network;
         sr_iov->section = TAKE_PTR(n);
 
-        r = ordered_hashmap_ensure_allocated(&network->sr_iov_by_section, &network_config_hash_ops);
-        if (r < 0)
-                return r;
-
-        r = ordered_hashmap_put(network->sr_iov_by_section, sr_iov->section, sr_iov);
+        r = ordered_hashmap_ensure_put(&network->sr_iov_by_section, &network_config_hash_ops, sr_iov->section, sr_iov);
         if (r < 0)
                 return r;
 
@@ -260,7 +256,7 @@ static int sr_iov_section_verify(SRIOV *sr_iov) {
         if (section_is_invalid(sr_iov->section))
                 return -EINVAL;
 
-        if (sr_iov->vf == (uint32_t) -1)
+        if (sr_iov->vf == UINT32_MAX)
                 return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
                                          "%s: [SRIOV] section without VirtualFunction= field configured. "
                                          "Ignoring [SRIOV] section from line %u.",
@@ -307,7 +303,7 @@ int config_parse_sr_iov_uint32(
 
         if (isempty(rvalue)) {
                 if (streq(lvalue, "VirtualFunction"))
-                        sr_iov->vf = (uint32_t) -1;
+                        sr_iov->vf = UINT32_MAX;
                 else if (streq(lvalue, "VLANId"))
                         sr_iov->vlan = 0;
                 else if (streq(lvalue, "QualityOfService"))