41 lines
1.2 KiB
Diff
41 lines
1.2 KiB
Diff
From 083c99d9bfaf8a0a04ea533bb2a17457d56945ec Mon Sep 17 00:00:00 2001
|
|
From: liuchao173 <55137861+liuchao173@users.noreply.github.com>
|
|
Date: Mon, 21 Oct 2019 19:15:11 +0800
|
|
Subject: [PATCH 26/53] when devpath is NULL, skip reading files
|
|
|
|
If devpath is NULL, read devpath/numa_node and devpath/local_cpus will fail. So just skip it. The old code won't cause any bugs.
|
|
---
|
|
classify.c | 9 +++++----
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/classify.c b/classify.c
|
|
index 550f3b6..81ad8a6 100644
|
|
--- a/classify.c
|
|
+++ b/classify.c
|
|
@@ -392,7 +392,7 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, struct irq_info *
|
|
|
|
get_numa_node:
|
|
numa_node = -1;
|
|
- if (numa_avail) {
|
|
+ if (devpath != NULL && numa_avail) {
|
|
sprintf(path, "%s/numa_node", devpath);
|
|
fd = fopen(path, "r");
|
|
if (fd) {
|
|
@@ -407,9 +407,10 @@ get_numa_node:
|
|
new->numa_node = get_numa_node(numa_node);
|
|
|
|
cpus_setall(new->cpumask);
|
|
-
|
|
- sprintf(path, "%s/local_cpus", devpath);
|
|
- process_one_line(path, get_mask_from_bitmap, &new->cpumask);
|
|
+ if (devpath != NULL) {
|
|
+ sprintf(path, "%s/local_cpus", devpath);
|
|
+ process_one_line(path, get_mask_from_bitmap, &new->cpumask);
|
|
+ }
|
|
|
|
log(TO_CONSOLE, LOG_INFO, "Adding IRQ %d to database\n", irq);
|
|
return new;
|
|
--
|
|
2.23.0
|
|
|