]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
authorPeng Fan <peng.fan@nxp.com>
Thu, 19 Sep 2024 12:08:11 +0000 (20:08 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 30 Sep 2024 15:40:30 +0000 (09:40 -0600)
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>
tools/power/cpupower/bench/parse.c

index e63dc11fa3a533efbe805b519831d65d55a56e3d..080678d9d74e2585533f9781392fb5eddb8f2187 100644 (file)
@@ -4,6 +4,7 @@
  *  Copyright (C) 2008 Christian Kornacker <ckornacker@suse.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;
        }