All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/ppc: Add error reporting when opening file fails
@ 2022-06-29  3:15 jianchunfu
  2022-06-29  5:56 ` Markus Armbruster
  0 siblings, 1 reply; 3+ messages in thread
From: jianchunfu @ 2022-06-29  3:15 UTC (permalink / raw)
  To: clg, danielhb413, david, groug, pbonzini
  Cc: qemu-ppc, kvm, qemu-devel, jianchunfu

Add error reporting before return when opening file fails.

Signed-off-by: jianchunfu <jianchunfu@cmss.chinamobile.com>
---
 target/ppc/kvm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index dc93b99189..ef9a871411 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1798,6 +1798,7 @@ static int read_cpuinfo(const char *field, char *value, int len)
 
     f = fopen("/proc/cpuinfo", "r");
     if (!f) {
+        fprintf(stderr, "Error opening /proc/cpuinfo: %s\n", strerror(errno));
         return -1;
     }
 
@@ -1906,6 +1907,7 @@ static uint64_t kvmppc_read_int_dt(const char *filename)
 
     f = fopen(filename, "rb");
     if (!f) {
+        fprintf(stderr, "Error opening %s: %s\n", filename, strerror(errno));
         return -1;
     }
 
-- 
2.18.4




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-29 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-29  3:15 [PATCH] target/ppc: Add error reporting when opening file fails jianchunfu
2022-06-29  5:56 ` Markus Armbruster
2022-06-29 21:06   ` Daniel Henrique Barboza

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.