]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: coding style fixlets done by coccinelle 36074/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Jan 2025 23:28:14 +0000 (08:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Jan 2025 23:28:42 +0000 (08:28 +0900)
src/boot/boot.c
src/boot/console.c
src/boot/random-seed.c
src/boot/splash.c
src/boot/util.c
src/nsresourced/nsresourcework.c

index 4ef519d404062ec6ecdd2807d3792e9c3962c673..a4e0b5551f42b2b94d1b386995c82210218451c5 100644 (file)
@@ -1179,12 +1179,11 @@ static void config_add_entry(Config *config, BootEntry *entry) {
         /* This is just for paranoia. */
         assert(config->n_entries < IDX_MAX);
 
-        if ((config->n_entries & 15) == 0) {
+        if ((config->n_entries & 15) == 0)
                 config->entries = xrealloc(
                                 config->entries,
                                 sizeof(void *) * config->n_entries,
                                 sizeof(void *) * (config->n_entries + 16));
-        }
         config->entries[config->n_entries++] = entry;
 }
 
index 067ee7c091c4f92de4c8a9a700c5d4b4ca06ec89..b174146cdf0a6e13d27fe0170823b68676cda875 100644 (file)
@@ -117,10 +117,8 @@ EFI_STATUS console_key_read(uint64_t *key, uint64_t timeout_usec) {
 
         /* If the extra input device we found returns something, always use that instead
          * to work around broken firmware freezing on ConIn/ConInEx. */
-        if (extraInEx && BS->CheckEvent(extraInEx->WaitForKeyEx) == EFI_SUCCESS) {
-                conInEx = extraInEx;
-                extraInEx = NULL;
-        }
+        if (extraInEx && BS->CheckEvent(extraInEx->WaitForKeyEx) == EFI_SUCCESS)
+                conInEx = TAKE_PTR(extraInEx);
 
         /* Do not fall back to ConIn if we have a ConIn that supports TextInputEx.
          * The two may be out of sync on some firmware, giving us double input. */
index 920f55eefc8f1a8c08393a3267472b7ba51ad38b..88fda5184a87a0d94586e73e916f6c90284ecb12 100644 (file)
@@ -199,7 +199,7 @@ EFI_STATUS process_random_seed(EFI_FILE *root_dir) {
                         EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE,
                         0);
         if (err != EFI_SUCCESS) {
-                if (err != EFI_NOT_FOUND && err != EFI_WRITE_PROTECTED)
+                if (!IN_SET(err, EFI_NOT_FOUND, EFI_WRITE_PROTECTED))
                         log_error_status(err, "Failed to open random seed file: %m");
                 return err;
         }
index 8daeb71cb25d1c0b543f1ba4a0b4509eb5272be2..7cf8d0d0c94c8c025c4f041187e0d09467c3a6b3 100644 (file)
@@ -86,7 +86,7 @@ static EFI_STATUS bmp_parse_header(
 
         case 16:
         case 32:
-                if (dib->compression != 0 && dib->compression != 3)
+                if (!IN_SET(dib->compression, 0, 3))
                         return EFI_UNSUPPORTED;
 
                 break;
index f5f748bc6cf1a86436c7565a88cd05a2ab717e55..ae1ad12e7be4295921588cb0a8da869457ef1367 100644 (file)
@@ -280,8 +280,7 @@ EFI_STATUS readdir(
 
         if (sz == 0) {
                 /* End of directory */
-                free(*buffer);
-                *buffer = NULL;
+                *buffer = mfree(*buffer);
                 *buffer_size = 0;
         }
 
@@ -306,8 +305,7 @@ char16_t **strv_free(char16_t **v) {
         for (char16_t **i = v; *i; i++)
                 free(*i);
 
-        free(v);
-        return NULL;
+        return mfree(v);
 }
 
 EFI_STATUS open_directory(
index 8c43581d8fea07acea2ce16bc63536d7bf292ec0..08277473e260e6065424433c206998504b977567 100644 (file)
@@ -1422,7 +1422,7 @@ static void hash_ether_addr(UserNamespaceInfo *userns_info, const char *ifname,
         siphash24_compress_string(strempty(ifname), &state);
         siphash24_compress_byte(0, &state); /* separator */
         n = htole64(n); /* add the 'index' to the mix in an endianess-independent fashion */
-        siphash24_compress(&n, sizeof(n), &state);
+        siphash24_compress_typesafe(n, &state);
 
         h = htole64(siphash24_finalize(&state));