mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
add gcc-14 -Werror=calloc-transposed-args compatibility
gcc-14 added a new `-Wcalloc-transposed-args` warning. Documentation says: ``` Warn about calls to allocation functions decorated with attribute alloc_size with two arguments, which use sizeof operator as the earlier size argument and don’t use it as the later size argument. This is a coding style warning. The first argument to calloc is documented to be number of elements in array, while the second argument is size of each element, so calloc (n, sizeof (int)) is preferred over calloc (sizeof (int), n). ``` Let's fix the existing occurrences. Found-by: gcc v14.1.1 20240507 Signed-off-by: Alexander Goncharov <chat@joursoir.net> Change-Id: Icb9842fbc2fa6ad4cd9dc9384c19fd3741eadb2e Reviewed-on: https://review.coreboot.org/c/flashrom/+/82657 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Robert Marko <robimarko@gmail.com> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
parent
8e30a6d8f7
commit
35a2168c32
2
s25f.c
2
s25f.c
@ -291,7 +291,7 @@ int s25fs_block_erase_d8(struct flashctx *flash, unsigned int addr, unsigned int
|
||||
s25fs_read_cr(flash, CR3NV_ADDR));
|
||||
|
||||
/* Restore CR3V when flashrom exits */
|
||||
uint8_t *data = calloc(sizeof(uint8_t), 1);
|
||||
uint8_t *data = calloc(1, sizeof(uint8_t));
|
||||
if (!data) {
|
||||
msg_cerr("Out of memory!\n");
|
||||
return 1;
|
||||
|
@ -310,7 +310,7 @@ static int spi_disable_blockprotect_generic(struct flashctx *flash, uint8_t bp_m
|
||||
}
|
||||
|
||||
/* Restore status register content upon exit in finalize_flash_access(). */
|
||||
uint8_t *data = calloc(sizeof(uint8_t), 1);
|
||||
uint8_t *data = calloc(1, sizeof(uint8_t));
|
||||
if (!data) {
|
||||
msg_cerr("Out of memory!\n");
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user