%m saves us some visual clutter and even some code size, so make use of
it.

Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>
---
 arch/arm/lib32/bootm.c         |  6 +++---
 arch/sandbox/os/common.c       |  3 +--
 commands/memtester/memtester.c | 11 +++++------
 common/blspec.c                |  2 +-
 drivers/misc/jtag.c            |  2 +-
 5 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c
index 34ce401e8fd9..3d3e01aa4138 100644
--- a/arch/arm/lib32/bootm.c
+++ b/arch/arm/lib32/bootm.c
@@ -204,12 +204,12 @@ static int bootm_load_tee_from_file(struct image_data 
*data)
 
        fd = open(data->tee_file, O_RDONLY);
        if (fd < 0) {
-               pr_err("%s", strerror(errno));
+               pr_err("%m\n");
                return -errno;
        }
 
        if (read_full(fd, &hdr, sizeof(hdr)) < 0) {
-               pr_err("%s", strerror(errno));
+               pr_err("%m\n");
                ret = -errno;
                goto out;
        }
@@ -219,7 +219,7 @@ static int bootm_load_tee_from_file(struct image_data *data)
                goto out;
 
        if (read_full(fd, (void *)data->tee_res->start, hdr.init_size) < 0) {
-               pr_err("%s", strerror(errno));
+               pr_err("%m\n");
                ret = -errno;
                release_region(data->tee_res);
                goto out;
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index d44213319422..c5043160b1f9 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -447,8 +447,7 @@ int linux_open_hostfile(struct hf_info *hf)
                                MAP_SHARED, fd, 0);
 
                if (hf->base == (unsigned long)MAP_FAILED)
-                       printf("warning: mmapping %s failed: %s\n",
-                              hf->filename, strerror(errno));
+                       printf("warning: mmapping %s failed: %m\n", 
hf->filename);
        } else {
                printf("warning: %s: contiguous map failed\n", hf->filename);
        }
diff --git a/commands/memtester/memtester.c b/commands/memtester/memtester.c
index f4adbfc855cb..aacb80d80936 100644
--- a/commands/memtester/memtester.c
+++ b/commands/memtester/memtester.c
@@ -109,8 +109,7 @@ static int do_memtester(int argc, char **argv) {
                 break;
             case 'd':
                 if (stat(optarg,&statbuf)) {
-                    printf("can not use %s as device: %s\n", optarg,
-                            strerror(errno));
+                    printf("can not use %s as device: %m\n", optarg);
                     return COMMAND_ERROR_USAGE;
                 } else {
                     if (!S_ISCHR(statbuf.st_mode) && 
!S_ISBLK(statbuf.st_mode)) {
@@ -164,14 +163,14 @@ static int do_memtester(int argc, char **argv) {
     if (memtester_use_phys) {
         memfd = open(device_name, O_RDWR);
         if (memfd == -1) {
-            printf("failed to open %s for physical memory: %s\n",
-                    device_name, strerror(errno));
+            printf("failed to open %s for physical memory: %m\n",
+                    device_name);
             return EXIT_FAIL_NONSTARTER;
         }
         buf = memmap(memfd, PROT_READ | PROT_WRITE) + memtester_physaddrbase;
         if (buf == MAP_FAILED) {
-            printf("failed to mmap %s for physical memory: %s\n",
-                    device_name, strerror(errno));
+            printf("failed to mmap %s for physical memory: %m\n",
+                    device_name);
             close(memfd);
             return EXIT_FAIL_NONSTARTER;
         }
diff --git a/common/blspec.c b/common/blspec.c
index dd3bb1c167d7..80ebe256ceaf 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -472,7 +472,7 @@ static int blspec_scan_directory(struct bootscanner 
*bootscanner,
 
        ret = glob(abspath, 0, NULL, &globb);
        if (ret) {
-               pr_debug("%s: %s: %s\n", __func__, abspath, strerror(errno));
+               pr_debug("%s: %s: %m\n", __func__, abspath);
                ret = -errno;
                goto err_out;
        }
diff --git a/drivers/misc/jtag.c b/drivers/misc/jtag.c
index cca0aba2d6b5..8673fa68505b 100644
--- a/drivers/misc/jtag.c
+++ b/drivers/misc/jtag.c
@@ -269,7 +269,7 @@ static void jtag_info(struct device *pdev)
                ret = jtag_ioctl(&info->cdev, JTAG_GET_ID, &jid);
                printf("  Device number: %d\n", dn);
                if (ret == -1)
-                       printf("   JTAG_GET_ID failed: %s\n", strerror(errno));
+                       printf("   JTAG_GET_ID failed: %m\n");
                else
                        printf("   ID: 0x%lX\n", jid.id);
        }
-- 
2.39.5


Reply via email to