From: Peng Fan Date: Thu, 19 Sep 2024 12:08:11 +0000 (+0800) Subject: pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails X-Git-Tag: v6.13-rc1~194^2^2~1^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0dd6507ab20066f39993065a73d2687b97a848d;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Shuah Khan --- diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c index e63dc11fa3a53..080678d9d74e2 100644 --- a/tools/power/cpupower/bench/parse.c +++ b/tools/power/cpupower/bench/parse.c @@ -4,6 +4,7 @@ * Copyright (C) 2008 Christian Kornacker */ +#include #include #include #include @@ -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; }