summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2019-06-11 11:12:22 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-06-13 08:14:56 +0200
commita8a508270be28d5d234e760cc3406cfad188b1d2 (patch)
tree8e603d5ed564ae8dd7078c5ee6962a7ab35ee85c /commands
parentafa8665f9f1a5666c63db762fcad53e7425126ef (diff)
downloadbarebox-a8a508270be28d5d234e760cc3406cfad188b1d2.tar.gz
commands: don't use stale errno when calling fb_open
fb_open returns a pointer and doesn't populate errno, which will result in a stale errno being evaluated by perror() on failure. Fix this by using strerror with the proper argument instead at call sites. While at it, correct the message prefix typo (s/fb_open/fb_open/). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/fbtest.c5
-rw-r--r--commands/splash.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/commands/fbtest.c b/commands/fbtest.c
index e5dd8ba..ff24a82 100644
--- a/commands/fbtest.c
+++ b/commands/fbtest.c
@@ -271,8 +271,9 @@ static int do_fbtest(int argc, char *argv[])
sc = fb_open(fbdev);
if (IS_ERR(sc)) {
- perror("fd_open");
- return PTR_ERR(sc);
+ int ret = -PTR_ERR(sc);
+ printf("fb_open: %s\n", strerror(ret));
+ return ret;
}
if (!pattern_name) {
diff --git a/commands/splash.c b/commands/splash.c
index 2b70b29..abd8287 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -54,8 +54,9 @@ static int do_splash(int argc, char *argv[])
sc = fb_open(fbdev);
if (IS_ERR(sc)) {
- perror("fd_open");
- return PTR_ERR(sc);
+ int ret = -PTR_ERR(sc);
+ printf("fb_open: %s\n", strerror(ret));
+ return ret;
}
buf = gui_screen_render_buffer(sc);