diff mbox series

[pseudo,2/2] pseudo_dv: Fix compiler warning

Message ID 20260213110624.1659480-2-richard.purdie@linuxfoundation.org
State New
Headers show
Series [pseudo,1/2] ports/linux: Ensure SYS_openat2 is defined | expand

Commit Message

Richard Purdie Feb. 13, 2026, 11:06 a.m. UTC
Fix:

pseudo_db.c: In function ‘pdb_log_traits’:
pseudo_db.c:786:26: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
  786 |         e = calloc(sizeof(*e), 1);
      |                          ^
pseudo_db.c:786:26: note: earlier argument should specify number of elements, later size of each element
pseudo_db.c: In function ‘pdb_history_entry’:
pseudo_db.c:1379:27: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
 1379 |         l = calloc(sizeof(log_entry), 1);
      |                           ^~~~~~~~~
pseudo_db.c:1379:27: note: earlier argument should specify number of elements, later size of each element

to reduce noise in compile logs.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 pseudo_db.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/pseudo_db.c b/pseudo_db.c
index 009ea2f..9713e0c 100644
--- a/pseudo_db.c
+++ b/pseudo_db.c
@@ -783,7 +783,7 @@  pdb_log_traits(pseudo_query_t *traits) {
 		pseudo_diag("%s: database error.\n", __func__);
 		return 1;
 	}
-	e = calloc(sizeof(*e), 1);
+	e = calloc(1, sizeof(*e));
 	if (!e) {
 		pseudo_diag("can't allocate space for log entry.");
 		return 1;
@@ -1376,7 +1376,7 @@  pdb_history_entry(log_history h) {
 		dberr(log_db, "statement failed");
 		return 0;
 	}
-	l = calloc(sizeof(log_entry), 1);
+	l = calloc(1, sizeof(log_entry));
 	if (!l) {
 		pseudo_diag("couldn't allocate log entry.\n");
 		return 0;