]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: a couple of tweaks suggested by Coccinelle
authorFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 17 Dec 2021 19:16:18 +0000 (20:16 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 17 Dec 2021 23:36:07 +0000 (08:36 +0900)
src/network/netdev/ipoib.c
src/network/networkd-address-generation.c

index c3f583fc4673ea0066be2dd39a5a947228fe32d3..e0ff9e8c62efa25a54ac08d8b005ad396df7c923 100644 (file)
@@ -139,7 +139,7 @@ int config_parse_ipoib_pkey(
                            rvalue);
                 return 0;
         }
-        if (u == 0 || u == 0x8000) {
+        if (IN_SET(u, 0, 0x8000)) {
                 log_syntax(unit, LOG_WARNING, filename, line, 0,
                            "IPoIB pkey cannot be 0 nor 0x8000, ignoring assignment: %s",
                            rvalue);
index c9c53b22cc0e98f5e1e587b00ebae74ae8ea3d9d..85110355a1da3e1017825f8c9743f4083fb3f0cc 100644 (file)
@@ -358,10 +358,9 @@ int config_parse_address_generation_type(
 
                                 addr = addr_alloc;
                         }
-                } else if (*addr == ',') {
-                        comma = addr;
-                        addr = NULL;
-                } else if (*addr == '\0') {
+                } else if (*addr == ',')
+                        comma = TAKE_PTR(addr);
+                else if (*addr == '\0') {
                         comma = NULL;
                         addr = NULL;
                 } else {