linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Thomas Renninger <trenn@suse.com>, Shuah Khan <shuah@kernel.org>,
	 "John B. Wyatt IV" <jwyatt@redhat.com>,
	John Kacur <jkacur@redhat.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Peng Fan <peng.fan@nxp.com>
Subject: [PATCH v2 1/2] pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
Date: Thu, 19 Sep 2024 20:08:11 +0800	[thread overview]
Message-ID: <20240919-pm-v2-1-0f25686556b5@nxp.com> (raw)
In-Reply-To: <20240919-pm-v2-0-0f25686556b5@nxp.com>

From: Peng Fan <peng.fan@nxp.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@nxp.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@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;
 	}

-- 
2.37.1


  reply	other threads:[~2024-09-19 11:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-19 12:08 [PATCH v2 0/2] tools: power: cpupower: Allow overriding cross-compiling envs Peng Fan (OSS)
2024-09-19 12:08 ` Peng Fan (OSS) [this message]
2024-09-19 12:08 ` [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding cross-compiling env params Peng Fan (OSS)
2024-11-21  4:41   ` Florian Fainelli
2024-11-21 12:40     ` Peng Fan
2024-11-21 17:02       ` Florian Fainelli
2024-11-22  0:13         ` Peng Fan
2024-11-22 17:34           ` Florian Fainelli
2024-11-29  0:38             ` Peng Fan
2024-09-19 16:38 ` [PATCH v2 0/2] tools: power: cpupower: Allow overriding cross-compiling envs John B. Wyatt IV
2024-09-20  8:58   ` Peng Fan
2024-09-20  9:01     ` Peng Fan
2024-09-20 12:41       ` John B. Wyatt IV
2024-09-20 12:44       ` John B. Wyatt IV
2024-09-23  6:26         ` Peng Fan
2024-09-30 15:52           ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240919-pm-v2-1-0f25686556b5@nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=jkacur@redhat.com \
    --cc=jwyatt@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=shuah@kernel.org \
    --cc=trenn@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).