Skip to content

Commit c0dd650

Browse files
MrVanshuahkh
authored andcommitted
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
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@nxp.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 7043a9f commit c0dd650

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/power/cpupower/bench/parse.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de>
55
*/
66

7+
#include <errno.h>
78
#include <stdio.h>
89
#include <stdlib.h>
910
#include <stdarg.h>
@@ -165,8 +166,8 @@ int prepare_config(const char *path, struct config *config)
165166

166167
configfile = fopen(path, "r");
167168
if (configfile == NULL) {
168-
perror("fopen");
169-
fprintf(stderr, "error: unable to read configfile\n");
169+
fprintf(stderr, "error: unable to read configfile: %s, %s\n",
170+
path, strerror(errno));
170171
free(config);
171172
return 1;
172173
}

0 commit comments

Comments
 (0)