[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240919-pm-v2-1-0f25686556b5@nxp.com>
Date: Thu, 19 Sep 2024 20:08:11 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: Thomas Renninger <trenn@...e.com>, Shuah Khan <shuah@...nel.org>,
"John B. Wyatt IV" <jwyatt@...hat.com>, John Kacur <jkacur@...hat.com>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
Peng Fan <peng.fan@....com>
Subject: [PATCH v2 1/2] pm: cpupower: bench: print config file path when
open cpufreq-bench.conf fails
From: Peng Fan <peng.fan@....com>
Print out the config file path when fopen failed. It will be easy
for users to know where to create the file.
Since we are here, use strerror to drop the usage of perror.
Signed-off-by: Peng Fan <peng.fan@....com>
---
tools/power/cpupower/bench/parse.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c
index e63dc11fa3a5..080678d9d74e 100644
--- a/tools/power/cpupower/bench/parse.c
+++ b/tools/power/cpupower/bench/parse.c
@@ -4,6 +4,7 @@
* Copyright (C) 2008 Christian Kornacker <ckornacker@...e.de>
*/
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -165,8 +166,8 @@ int prepare_config(const char *path, struct config *config)
configfile = fopen(path, "r");
if (configfile == NULL) {
- perror("fopen");
- fprintf(stderr, "error: unable to read configfile\n");
+ fprintf(stderr, "error: unable to read configfile: %s, %s\n",
+ path, strerror(errno));
free(config);
return 1;
}
--
2.37.1
Powered by blists - more mailing lists