summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-09-28 17:34:31 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-29 08:41:53 +0200
commit9699096f1eccd742d898f471b046181ea90dd582 (patch)
tree1b62f4c159a6ae9b90eac7d750a4833b0e30a7dc /commands
parent12d74001d52911dfb96d81b774183aeaba21370c (diff)
downloadbarebox-9699096f1eccd742d898f471b046181ea90dd582.tar.gz
barebox-9699096f1eccd742d898f471b046181ea90dd582.tar.xz
treewide: replace strerror(-PTR_ERR(errno)) with %pe format specifier
Using %pe instead of PTR_ERR has the benefit of being less verbose and less error-prone (no negation necessary) while potentially reducing code size. Make use of it. 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
-rw-r--r--commands/ubi.c2
3 files changed, 5 insertions, 7 deletions
diff --git a/commands/fbtest.c b/commands/fbtest.c
index ff24a8252a..30d96f6af4 100644
--- a/commands/fbtest.c
+++ b/commands/fbtest.c
@@ -271,9 +271,8 @@ static int do_fbtest(int argc, char *argv[])
sc = fb_open(fbdev);
if (IS_ERR(sc)) {
- int ret = -PTR_ERR(sc);
- printf("fb_open: %s\n", strerror(ret));
- return ret;
+ printf("fb_open: %pe\n", sc);
+ return COMMAND_ERROR;
}
if (!pattern_name) {
diff --git a/commands/splash.c b/commands/splash.c
index abd82873cb..f1cc8c83bd 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -54,9 +54,8 @@ static int do_splash(int argc, char *argv[])
sc = fb_open(fbdev);
if (IS_ERR(sc)) {
- int ret = -PTR_ERR(sc);
- printf("fb_open: %s\n", strerror(ret));
- return ret;
+ printf("fb_open: %pe\n", sc);
+ return COMMAND_ERROR;
}
buf = gui_screen_render_buffer(sc);
diff --git a/commands/ubi.c b/commands/ubi.c
index f37684102d..f866f00160 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -304,8 +304,8 @@ static int do_ubirmvol(int argc, char *argv[])
desc = ubi_open_volume_nm(ubinum, argv[2], UBI_EXCLUSIVE);
if (IS_ERR(desc)) {
+ printf("failed to open volume %s: %pe\n", argv[2], desc);
ret = PTR_ERR(desc);
- printf("failed to open volume %s: %s\n", argv[2], strerror(-ret));
goto err;
}