irqbalance/irqbalance-modify-the-order-of-input-parameter-for-c.patch
2020-07-03 17:09:39 +08:00

92 lines
2.5 KiB
Diff

From 28df9e6207b4e894d9232b7c6d8eab7a0f02c7ad Mon Sep 17 00:00:00 2001
From: Yunfeng Ye <yeyunfeng@huawei.com>
Date: Wed, 30 Oct 2019 19:15:29 +0800
Subject: [PATCH 34/53] irqbalance: modify the order of input parameter for
calloc()
The man docs about calloc:
void *calloc(size_t nmemb, size_t size);
The calloc() function allocates memory for an array of nmemb elements
of size bytes each
The first parameter is elements count, so change the order of input
parameters for calloc().
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
classify.c | 4 ++--
cputree.c | 6 +++---
procinterrupts.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/classify.c b/classify.c
index 2c0e7ed..b999cab 100644
--- a/classify.c
+++ b/classify.c
@@ -275,7 +275,7 @@ static void add_banned_irq(int irq, GList **list)
if (entry)
return;
- new = calloc(sizeof(struct irq_info), 1);
+ new = calloc(1, sizeof(struct irq_info));
if (!new) {
log(TO_CONSOLE, LOG_WARNING, "No memory to ban irq %d\n", irq);
return;
@@ -366,7 +366,7 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, struct irq_info *
return NULL;
}
- new = calloc(sizeof(struct irq_info), 1);
+ new = calloc(1, sizeof(struct irq_info));
if (!new)
return NULL;
diff --git a/cputree.c b/cputree.c
index 1c1c99b..97d4a78 100644
--- a/cputree.c
+++ b/cputree.c
@@ -192,7 +192,7 @@ static struct topo_obj* add_cache_domain_to_package(struct topo_obj *cache,
}
if (!entry) {
- package = calloc(sizeof(struct topo_obj), 1);
+ package = calloc(1, sizeof(struct topo_obj));
if (!package)
return NULL;
package->mask = package_mask;
@@ -238,7 +238,7 @@ static struct topo_obj* add_cpu_to_cache_domain(struct topo_obj *cpu,
}
if (!entry) {
- cache = calloc(sizeof(struct topo_obj), 1);
+ cache = calloc(1, sizeof(struct topo_obj));
if (!cache)
return NULL;
cache->obj_type = OBJ_TYPE_CACHE;
@@ -302,7 +302,7 @@ static void do_one_cpu(char *path)
if (offline_status)
return;
- cpu = calloc(sizeof(struct topo_obj), 1);
+ cpu = calloc(1, sizeof(struct topo_obj));
if (!cpu)
return;
diff --git a/procinterrupts.c b/procinterrupts.c
index 1a7ff26..35d3be8 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -214,7 +214,7 @@ GList* collect_full_irq_list()
*c = 0;
number = strtoul(line, NULL, 10);
- info = calloc(sizeof(struct irq_info), 1);
+ info = calloc(1, sizeof(struct irq_info));
if (info) {
info->irq = number;
if (strstr(irq_name, "-event") != NULL && is_xen_dyn == 1) {
--
2.23.0