From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 4/5] treewide: fix wrong signed value passed to strerror
Date: Wed, 16 Apr 2025 12:37:47 +0200 [thread overview]
Message-ID: <20250416103748.265415-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250416103748.265415-1-a.fatoum@pengutronix.de>
strerror is meant for use with the positive integers stored in errno,
but most error codes in barebox are negative. Fix instances of passing
negative values to strerror by using %pe + ERR_PTR instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/boards/at91sam9m10ihd/hw_version.c | 2 +-
arch/arm/boards/at91sam9x5ek/hw_version.c | 2 +-
arch/arm/boards/crystalfontz-cfa10036/hwdetect.c | 2 +-
arch/arm/boards/haba-knx/init.c | 2 +-
drivers/aiodev/imx_thermal.c | 4 ++--
drivers/crypto/caam/rng_self_test.c | 4 ++--
drivers/dma/apbh_dma.c | 3 +--
drivers/mci/arasan-sdhci.c | 5 ++---
drivers/mci/imx-esdhc.c | 3 +--
drivers/mtd/ubi/barebox.c | 2 +-
drivers/spi/imx_spi.c | 4 ++--
11 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/arch/arm/boards/at91sam9m10ihd/hw_version.c b/arch/arm/boards/at91sam9m10ihd/hw_version.c
index 0b8b7cc884eb..9ae4ccb77c75 100644
--- a/arch/arm/boards/at91sam9m10ihd/hw_version.c
+++ b/arch/arm/boards/at91sam9m10ihd/hw_version.c
@@ -111,7 +111,7 @@ static int at91sam9m10ihd_read_w1(const char *file, struct one_wire_info *info)
close(fd);
err:
if (ret)
- pr_err("can not read 1-wire %s (%s)\n", file, strerror(ret));
+ pr_err("can not read 1-wire %s (%pe)\n", file, ERR_PTR(ret));
return ret;
}
diff --git a/arch/arm/boards/at91sam9x5ek/hw_version.c b/arch/arm/boards/at91sam9x5ek/hw_version.c
index 1224f4753c3b..9c6bd6866098 100644
--- a/arch/arm/boards/at91sam9x5ek/hw_version.c
+++ b/arch/arm/boards/at91sam9x5ek/hw_version.c
@@ -122,7 +122,7 @@ static int at91sam9x5ek_read_w1(const char *file, struct one_wire_info *info)
close(fd);
err:
if (ret)
- pr_err("can not read 1-wire %s (%s)\n", file, strerror(ret));
+ pr_err("can not read 1-wire %s (%pe)\n", file, ERR_PTR(ret));
return ret;
}
diff --git a/arch/arm/boards/crystalfontz-cfa10036/hwdetect.c b/arch/arm/boards/crystalfontz-cfa10036/hwdetect.c
index fc39f0849a7d..76318b4d56f1 100644
--- a/arch/arm/boards/crystalfontz-cfa10036/hwdetect.c
+++ b/arch/arm/boards/crystalfontz-cfa10036/hwdetect.c
@@ -50,7 +50,7 @@ static int cfa10036_read_eeprom(const char *file, struct cfa_eeprom_info *info)
close(fd);
err:
if (ret)
- pr_err("can not read eeprom %s (%s)\n", file, strerror(ret));
+ pr_err("can not read eeprom %s (%pe)\n", file, ERR_PTR(ret));
return ret;
}
diff --git a/arch/arm/boards/haba-knx/init.c b/arch/arm/boards/haba-knx/init.c
index d86e84e71a3b..45bcd2c83668 100644
--- a/arch/arm/boards/haba-knx/init.c
+++ b/arch/arm/boards/haba-knx/init.c
@@ -139,7 +139,7 @@ static int haba_set_ethaddr(void)
close(fd);
err:
if (ret)
- pr_err("can't read eeprom /dev/eeprom0 (%s)\n", strerror(ret));
+ pr_err("can't read eeprom /dev/eeprom0 (%pe)\n", ERR_PTR(ret));
return ret;
}
diff --git a/drivers/aiodev/imx_thermal.c b/drivers/aiodev/imx_thermal.c
index 2693ad05e0e5..5db28d1bc51a 100644
--- a/drivers/aiodev/imx_thermal.c
+++ b/drivers/aiodev/imx_thermal.c
@@ -142,8 +142,8 @@ static int imx_thermal_probe(struct device *dev)
ret = clk_enable(imx_thermal->clk);
if (ret) {
- dev_err(dev, "Failed to enable clock: %s\n",
- strerror(ret));
+ dev_err(dev, "Failed to enable clock: %pe\n",
+ ERR_PTR(ret));
goto put_clock;
}
diff --git a/drivers/crypto/caam/rng_self_test.c b/drivers/crypto/caam/rng_self_test.c
index b6fcc3bc0947..12f5e192080f 100644
--- a/drivers/crypto/caam/rng_self_test.c
+++ b/drivers/crypto/caam/rng_self_test.c
@@ -194,8 +194,8 @@ int caam_rng_self_test(struct device *dev, const u8 caam_era, const u8 rngvid,
/* wait for job completion */
ret = caam_jr_enqueue(dev, desc, rng_self_test_done, &job_err);
if (ret) {
- pr_err("Running RNG self-test descriptor failed: %d %s\n",
- ret, strerror(ret));
+ pr_err("Running RNG self-test descriptor failed: %pe\n",
+ ERR_PTR(ret));
goto err;
}
if (job_err) {
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index 2f19033aaf71..298f706f1bcd 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -162,8 +162,7 @@ static int apbh_dma_probe(struct device *dev)
ret = clk_enable(apbh->clk);
if (ret) {
- dev_err(dev, "Failed to enable clock: %s\n",
- strerror(ret));
+ dev_err(dev, "Failed to enable clock: %pe\n", ERR_PTR(ret));
return ret;
}
diff --git a/drivers/mci/arasan-sdhci.c b/drivers/mci/arasan-sdhci.c
index 112fb5a669d5..e987ff654862 100644
--- a/drivers/mci/arasan-sdhci.c
+++ b/drivers/mci/arasan-sdhci.c
@@ -753,14 +753,13 @@ static int arasan_sdhci_probe(struct device *dev)
}
ret = clk_enable(clk_ahb);
if (ret) {
- dev_err(dev, "Failed to enable AHB clock: %s\n",
- strerror(ret));
+ dev_err(dev, "Failed to enable AHB clock: %pe\n", ERR_PTR(ret));
return ret;
}
ret = clk_enable(clk_xin);
if (ret) {
- dev_err(dev, "Failed to enable SD clock: %s\n", strerror(ret));
+ dev_err(dev, "Failed to enable SD clock: %pe\n", ERR_PTR(ret));
return ret;
}
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 54309aec2f74..ebc7ed539da9 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -301,8 +301,7 @@ static int fsl_esdhc_probe(struct device *dev)
ret = clk_enable(host->clk);
if (ret) {
- dev_err(dev, "Failed to enable clock: %s\n",
- strerror(ret));
+ dev_err(dev, "Failed to enable clock: %pe\n", ERR_PTR(ret));
goto err_clk_put;
}
diff --git a/drivers/mtd/ubi/barebox.c b/drivers/mtd/ubi/barebox.c
index 5d7bf69cc7c2..6b006dfa1de6 100644
--- a/drivers/mtd/ubi/barebox.c
+++ b/drivers/mtd/ubi/barebox.c
@@ -135,7 +135,7 @@ static int ubi_volume_cdev_close(struct cdev *cdev)
err = ubi_check_volume(ubi, vol->vol_id);
if (err < 0) {
- ubi_err(ubi, "ubi volume check failed: %s", strerror(err));
+ ubi_err(ubi, "ubi volume check failed: %pe", ERR_PTR(err));
return err;
}
diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
index 5310a2715d8a..09893ac008e8 100644
--- a/drivers/spi/imx_spi.c
+++ b/drivers/spi/imx_spi.c
@@ -618,8 +618,8 @@ static int imx_spi_probe(struct device *dev)
ret = clk_enable(imx->clk);
if (ret) {
- dev_err(dev, "Failed to enable clock: %s\n",
- strerror(ret));
+ dev_err(dev, "Failed to enable clock: %pe\n",
+ ERR_PTR(ret));
return ret;
}
--
2.39.5
next prev parent reply other threads:[~2025-04-16 10:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 10:37 [PATCH 1/5] bootm: fix error reporting around optee_verify_header_request_region Ahmad Fatoum
2025-04-16 10:37 ` [PATCH 2/5] treewide: replace strerror of errno with %m Ahmad Fatoum
2025-04-16 10:37 ` [PATCH 3/5] commands: memtester: fix erroneous use of errno Ahmad Fatoum
2025-04-16 10:37 ` Ahmad Fatoum [this message]
2025-04-16 10:37 ` [PATCH 5/5] treewide: replace strerror with %pe format specifier Ahmad Fatoum
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=20250416103748.265415-4-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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