tree-wide: coding style fixlets done by coccinelle

This commit is contained in:
Yu Watanabe
2025-01-19 08:28:42 +09:00
parent 62123950c6
commit 99de29945f
6 changed files with 8 additions and 13 deletions
+1 -2
View 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;
}
+2 -4
View 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. */
+1 -1
View 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;
}
+1 -1
View 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;
+2 -4
View 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(
+1 -1
View 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));