* [PATCH 1/4] vsprintf: constify pointers where appropriate
@ 2020-09-28 15:34 Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 2/4] vsprintf: add %pe format specifier for printing symbolic error names Ahmad Fatoum
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-09-28 15:34 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
No functional change, but makes code bit more future proof when it is
extended.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
lib/vsprintf.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 6fe0283e8466..3e5f4db75ac8 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -41,7 +41,8 @@ static int skip_atoi(const char **s)
#define SMALL 32 /* Must be 32 == 0x20 */
#define SPECIAL 64 /* 0x */
-static char *number(char *buf, char *end, unsigned long long num, int base, int size, int precision, int type)
+static char *number(char *buf, const char *end, unsigned long long num, int base, int size,
+ int precision, int type)
{
/* we are called with base 8, 10 or 16, only, thus don't need "G..." */
static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
@@ -146,7 +147,8 @@ static char *number(char *buf, char *end, unsigned long long num, int base, int
#define PAGE_SIZE 4096
#endif
-static char *string(char *buf, char *end, char *s, int field_width, int precision, int flags)
+static char *string(char *buf, const char *end, const char *s, int field_width,
+ int precision, int flags)
{
int len, i;
@@ -176,7 +178,8 @@ static char *string(char *buf, char *end, char *s, int field_width, int precisio
}
#ifndef __PBL__
-static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int precision, int flags)
+static char *symbol_string(char *buf, const char *end, const void *ptr, int field_width,
+ int precision, int flags)
{
unsigned long value = (unsigned long) ptr;
#ifdef CONFIG_KALLSYMS
@@ -191,7 +194,7 @@ static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int
}
static noinline_for_stack
-char *ip4_addr_string(char *buf, char *end, const u8 *addr, int field_width,
+char *ip4_addr_string(char *buf, const char *end, const u8 *addr, int field_width,
int precision, int flags, const char *fmt)
{
char ip4_addr[sizeof("255.255.255.255")];
@@ -212,8 +215,8 @@ char *ip4_addr_string(char *buf, char *end, const u8 *addr, int field_width,
}
static noinline_for_stack
-char *uuid_string(char *buf, char *end, const u8 *addr, int field_width,
- int precision, int flags, const char *fmt)
+char *uuid_string(char *buf, const char *end, const u8 *addr, int field_width,
+ int precision, int flags, const char *fmt)
{
char uuid[sizeof("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")];
char *p = uuid;
@@ -259,8 +262,8 @@ char *uuid_string(char *buf, char *end, const u8 *addr, int field_width,
}
static noinline_for_stack
-char *address_val(char *buf, char *end, const void *addr,
- int field_width, int precision, int flags, const char *fmt)
+char *address_val(char *buf, const char *end, const void *addr,
+ int field_width, int precision, int flags, const char *fmt)
{
unsigned long long num;
@@ -314,7 +317,8 @@ char *address_val(char *buf, char *end, const void *addr,
* function pointers are really function descriptors, which contain a
* pointer to the real address.
*/
-static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field_width, int precision, int flags)
+static char *pointer(const char *fmt, char *buf, const char *end, const void *ptr,
+ int field_width, int precision, int flags)
{
switch (*fmt) {
case 'S':
@@ -350,7 +354,8 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags);
}
#else
-static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field_width, int precision, int flags)
+static char *pointer(const char *fmt, char *buf, const char *end, const void *ptr,
+ int field_width, int precision, int flags)
{
flags |= SMALL;
if (field_width == -1) {
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] vsprintf: add %pe format specifier for printing symbolic error names
2020-09-28 15:34 [PATCH 1/4] vsprintf: constify pointers where appropriate Ahmad Fatoum
@ 2020-09-28 15:34 ` Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 3/4] vsprintf: retire strerrorp in favor of %pe Ahmad Fatoum
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-09-28 15:34 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum, Uwe Kleine-König
Starting with v5.5, Linux has a format specifier for printing error
pointers. We have had strerror in barebox before that, but lets wire it
into vsprintf with the same format specifier that Linux now uses.
This yields less verbose call sites and makes Linux drivers more portable
to barebox in future. This also has the potential to reduce code size as
the previously "inlined" strerror at callsites can now be replaced by
a single vsprintf.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
lib/vsprintf.c | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 3e5f4db75ac8..3fccfa7a56ba 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -177,6 +177,17 @@ static char *string(char *buf, const char *end, const char *s, int field_width,
return buf;
}
+static char *raw_pointer(char *buf, const char *end, const void *ptr, int field_width,
+ int precision, int flags)
+{
+ flags |= SMALL;
+ if (field_width == -1) {
+ field_width = 2*sizeof(void *);
+ flags |= ZEROPAD;
+ }
+ return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags);
+}
+
#ifndef __PBL__
static char *symbol_string(char *buf, const char *end, const void *ptr, int field_width,
int precision, int flags)
@@ -214,6 +225,16 @@ char *ip4_addr_string(char *buf, const char *end, const u8 *addr, int field_widt
return string(buf, end, ip4_addr, field_width, precision, flags);
}
+static
+char *error_string(char *buf, const char *end, const u8 *errptr, int field_width,
+ int precision, int flags, const char *fmt)
+{
+ if (!IS_ERR(errptr))
+ return raw_pointer(buf, end, errptr, field_width, precision, flags);
+
+ return string(buf, end, strerrorp(errptr), field_width, precision, flags);
+}
+
static noinline_for_stack
char *uuid_string(char *buf, const char *end, const u8 *addr, int field_width,
int precision, int flags, const char *fmt)
@@ -345,24 +366,18 @@ static char *pointer(const char *fmt, char *buf, const char *end, const void *pt
return ip4_addr_string(buf, end, ptr, field_width, precision, flags, fmt);
}
break;
+ case 'e':
+ return error_string(buf, end, ptr, field_width, precision, flags, fmt);
}
- flags |= SMALL;
- if (field_width == -1) {
- field_width = 2*sizeof(void *);
- flags |= ZEROPAD;
- }
- return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags);
+
+ return raw_pointer(buf, end, ptr, field_width, precision, flags);
}
+
#else
static char *pointer(const char *fmt, char *buf, const char *end, const void *ptr,
int field_width, int precision, int flags)
{
- flags |= SMALL;
- if (field_width == -1) {
- field_width = 2*sizeof(void *);
- flags |= ZEROPAD;
- }
- return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags);
+ return raw_pointer(buf, end, ptr, field_width, precision, flags);
}
#endif
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] vsprintf: retire strerrorp in favor of %pe
2020-09-28 15:34 [PATCH 1/4] vsprintf: constify pointers where appropriate Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 2/4] vsprintf: add %pe format specifier for printing symbolic error names Ahmad Fatoum
@ 2020-09-28 15:34 ` Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 4/4] treewide: replace strerror(-PTR_ERR(errno)) with %pe format specifier Ahmad Fatoum
2020-09-29 6:42 ` [PATCH 1/4] vsprintf: constify pointers where appropriate Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-09-28 15:34 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
strerrorp() is only used along with printf. We now have a format
specifier for printing error pointers directly, so use that and
remove strerrorp.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/mach-layerscape/ppa.c | 5 ++---
commands/of_diff.c | 4 ++--
common/bootm.c | 3 +--
common/usbgadget.c | 3 +--
drivers/clk/clk-qoric.c | 2 +-
drivers/mfd/superio.c | 3 +--
drivers/misc/acpi-test.c | 2 +-
drivers/usb/imx/imx-usb-phy.c | 2 +-
drivers/video/imx-ipu-v3/imx-ldb.c | 8 ++++----
fs/ubifs/ubifs.c | 3 +--
include/errno.h | 5 -----
lib/vsprintf.c | 2 +-
12 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/arch/arm/mach-layerscape/ppa.c b/arch/arm/mach-layerscape/ppa.c
index 6ab7659be730..f38220dbc1e7 100644
--- a/arch/arm/mach-layerscape/ppa.c
+++ b/arch/arm/mach-layerscape/ppa.c
@@ -69,14 +69,13 @@ static int ppa_init(void *ppa, size_t ppa_size, void *sec_firmware_addr)
fit = fit_open_buf(ppa, ppa_size, false, BOOTM_VERIFY_AVAILABLE);
if (IS_ERR(fit)) {
- pr_err("Cannot open ppa FIT image: %s\n", strerrorp(fit));
+ pr_err("Cannot open ppa FIT image: %pe\n", fit);
return PTR_ERR(fit);
}
conf = fit_open_configuration(fit, NULL);
if (IS_ERR(conf)) {
- pr_err("Cannot open default config in ppa FIT image: %s\n",
- strerrorp(conf));
+ pr_err("Cannot open default config in ppa FIT image: %pe\n", conf);
ret = PTR_ERR(fit);
goto err;
}
diff --git a/commands/of_diff.c b/commands/of_diff.c
index 8acfd42a6b88..ec039776cf34 100644
--- a/commands/of_diff.c
+++ b/commands/of_diff.c
@@ -64,14 +64,14 @@ static int do_of_diff(int argc, char *argv[])
b = get_tree(argv[2], root);
if (IS_ERR(a)) {
- printf("Cannot read %s: %s\n", argv[1], strerrorp(a));
+ printf("Cannot read %s: %pe\n", argv[1], a);
ret = COMMAND_ERROR;
a = NULL;
goto out;
}
if (IS_ERR(b)) {
- printf("Cannot read %s: %s\n", argv[2], strerrorp(b));
+ printf("Cannot read %s: %pe\n", argv[2], b);
ret = COMMAND_ERROR;
b = NULL;
goto out;
diff --git a/common/bootm.c b/common/bootm.c
index 60b8bf10a864..5da78ce379e1 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -648,8 +648,7 @@ int bootm_boot(struct bootm_data *bootm_data)
fit = fit_open(data->os_file, data->verbose, data->verify);
if (IS_ERR(fit)) {
- printf("Loading FIT image %s failed with: %s\n", data->os_file,
- strerrorp(fit));
+ printf("Loading FIT image %s failed with: %pe\n", data->os_file, fit);
ret = PTR_ERR(fit);
goto err_out;
}
diff --git a/common/usbgadget.c b/common/usbgadget.c
index b4f4ba04ca8c..042fbb8f6d51 100644
--- a/common/usbgadget.c
+++ b/common/usbgadget.c
@@ -35,8 +35,7 @@ static struct file_list *parse(const char *files)
{
struct file_list *list = file_list_parse(files);
if (IS_ERR(list)) {
- pr_err("Parsing file list \"%s\" failed: %s\n", files,
- strerrorp(list));
+ pr_err("Parsing file list \"%s\" failed: %pe\n", files, list);
return NULL;
}
return list;
diff --git a/drivers/clk/clk-qoric.c b/drivers/clk/clk-qoric.c
index 2ffc7613fa53..b3e0780bc816 100644
--- a/drivers/clk/clk-qoric.c
+++ b/drivers/clk/clk-qoric.c
@@ -589,7 +589,7 @@ static void __init clockgen_init(struct device_node *np,
clockgen.sysclk = of_clk_get(clockgen.node, 0);
if (IS_ERR(clockgen.sysclk)) {
- pr_err("sysclk not found: %s\n", strerrorp(clockgen.sysclk));
+ pr_err("sysclk not found: %pe\n", clockgen.sysclk);
return;
}
diff --git a/drivers/mfd/superio.c b/drivers/mfd/superio.c
index ab94a4fa8f75..fff26968ea29 100644
--- a/drivers/mfd/superio.c
+++ b/drivers/mfd/superio.c
@@ -87,8 +87,7 @@ void superio_chip_add(struct superio_chip *siochip)
regmap = regmap_init(siochip->dev, &superio_regmap_bus, siochip,
&superio_regmap_config);
if (IS_ERR(regmap))
- pr_warn("creating %s regmap failed: %s\n",
- chipname, strerrorp(regmap));
+ pr_warn("creating %s regmap failed: %pe\n", chipname, regmap);
ret = regmap_register_cdev(regmap, chipname);
if (ret)
diff --git a/drivers/misc/acpi-test.c b/drivers/misc/acpi-test.c
index 970b435a0eec..1d6814ebcf27 100644
--- a/drivers/misc/acpi-test.c
+++ b/drivers/misc/acpi-test.c
@@ -29,7 +29,7 @@ static int acpi_test_probe(struct device_d *dev)
sdt = (u8 __force *)dev_request_mem_region_by_name(dev, "SDT");
if (IS_ERR(sdt)) {
- dev_err(dev, "no SDT resource available: %s\n", strerrorp(sdt));
+ dev_err(dev, "no SDT resource available: %pe\n", sdt);
return PTR_ERR(sdt);
}
diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index c23a747d0b1e..e3f3bb3612fe 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -165,7 +165,7 @@ static int imx_usbphy_probe(struct device_d *dev)
imxphy->clk = clk_get(dev, NULL);
if (IS_ERR(imxphy->clk)) {
- dev_err(dev, "could not get clk: %s\n", strerrorp(imxphy->clk));
+ dev_err(dev, "could not get clk: %pe\n", imxphy->clk);
ret = PTR_ERR(imxphy->clk);
goto err_clk;
}
diff --git a/drivers/video/imx-ipu-v3/imx-ldb.c b/drivers/video/imx-ipu-v3/imx-ldb.c
index 9b4524274c4e..d7793bdc0e3f 100644
--- a/drivers/video/imx-ipu-v3/imx-ldb.c
+++ b/drivers/video/imx-ipu-v3/imx-ldb.c
@@ -162,7 +162,7 @@ static int imx6q_set_clock(struct imx_ldb *ldb, int ipuno, int dino, int chno, u
diclk = clk_lookup(clkname);
free(clkname);
if (IS_ERR(diclk)) {
- dev_err(ldb->dev, "failed to get di clk: %s\n", strerrorp(diclk));
+ dev_err(ldb->dev, "failed to get di clk: %pe\n", diclk);
return PTR_ERR(diclk);
}
@@ -170,7 +170,7 @@ static int imx6q_set_clock(struct imx_ldb *ldb, int ipuno, int dino, int chno, u
ldbclk = clk_lookup(clkname);
free(clkname);
if (IS_ERR(ldbclk)) {
- dev_err(ldb->dev, "failed to get ldb clk: %s\n", strerrorp(ldbclk));
+ dev_err(ldb->dev, "failed to get ldb clk: %pe\n", ldbclk);
return PTR_ERR(ldbclk);
}
@@ -233,7 +233,7 @@ static int imx53_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di,
diclk = clk_lookup(clkname);
free(clkname);
if (IS_ERR(diclk)) {
- dev_err(ldb->dev, "failed to get di clk: %s\n", strerrorp(diclk));
+ dev_err(ldb->dev, "failed to get di clk: %pe\n", diclk);
return PTR_ERR(diclk);
}
@@ -241,7 +241,7 @@ static int imx53_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di,
ldbclk = clk_lookup(clkname);
free(clkname);
if (IS_ERR(ldbclk)) {
- dev_err(ldb->dev, "failed to get ldb clk: %s\n", strerrorp(ldbclk));
+ dev_err(ldb->dev, "failed to get ldb clk: %pe\n", ldbclk);
return PTR_ERR(ldbclk);
}
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index fd3561924657..6434cc61c55f 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -430,8 +430,7 @@ static int ubifs_probe(struct device_d *dev)
priv->ubi = ubi_open_volume_cdev(priv->cdev, UBI_READONLY);
if (IS_ERR(priv->ubi)) {
- dev_err(dev, "failed to open ubi volume: %s\n",
- strerrorp(priv->ubi));
+ dev_err(dev, "failed to open ubi volume: %pe\n", priv->ubi);
ret = PTR_ERR(priv->ubi);
goto err_free;
}
diff --git a/include/errno.h b/include/errno.h
index 50f00de5d636..262c9fc3eb1c 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -11,9 +11,4 @@ void perror(const char *s);
const char *errno_str(void);
const char *strerror(int errnum);
-static inline const char *strerrorp(const void *errp)
-{
- return strerror(-PTR_ERR(errp));
-}
-
#endif /* __ERRNO_H */
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 3fccfa7a56ba..4834501ff124 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -232,7 +232,7 @@ char *error_string(char *buf, const char *end, const u8 *errptr, int field_width
if (!IS_ERR(errptr))
return raw_pointer(buf, end, errptr, field_width, precision, flags);
- return string(buf, end, strerrorp(errptr), field_width, precision, flags);
+ return string(buf, end, strerror(-PTR_ERR(errptr)), field_width, precision, flags);
}
static noinline_for_stack
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] treewide: replace strerror(-PTR_ERR(errno)) with %pe format specifier
2020-09-28 15:34 [PATCH 1/4] vsprintf: constify pointers where appropriate Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 2/4] vsprintf: add %pe format specifier for printing symbolic error names Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 3/4] vsprintf: retire strerrorp in favor of %pe Ahmad Fatoum
@ 2020-09-28 15:34 ` Ahmad Fatoum
2020-09-29 6:42 ` [PATCH 1/4] vsprintf: constify pointers where appropriate Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-09-28 15:34 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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>
---
commands/fbtest.c | 5 ++---
commands/splash.c | 5 ++---
commands/ubi.c | 2 +-
common/state/state.c | 3 +--
drivers/net/designware_tegra186.c | 5 ++---
drivers/usb/imx/chipidea-imx.c | 5 ++---
drivers/video/imx-ipu-v3/ipu-common.c | 5 ++---
lib/cmdlinepart.c | 7 +++----
8 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/commands/fbtest.c b/commands/fbtest.c
index ff24a8252a8c..30d96f6af41f 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 abd82873cb6d..f1cc8c83bd97 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 f37684102dfc..f866f00160b0 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;
}
diff --git a/common/state/state.c b/common/state/state.c
index d42920985d14..9d04eab312eb 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -271,9 +271,8 @@ static int state_convert_node_variable(struct state *state,
if (conv == STATE_CONVERT_FROM_NODE_CREATE) {
sv = vtype->create(state, name, node, vtype);
if (IS_ERR(sv)) {
+ dev_err(&state->dev, "failed to create %s: %pe\n", name, sv);
ret = PTR_ERR(sv);
- dev_err(&state->dev, "failed to create %s: %s\n", name,
- strerror(-ret));
goto out_free;
}
diff --git a/drivers/net/designware_tegra186.c b/drivers/net/designware_tegra186.c
index 5348f65c4146..f3b37be3ce4d 100644
--- a/drivers/net/designware_tegra186.c
+++ b/drivers/net/designware_tegra186.c
@@ -213,9 +213,8 @@ static int eqos_init_tegra186(struct device_d *dev, struct eqos *eqos)
priv->rst = reset_control_get(dev, "eqos");
if (IS_ERR(priv->rst)) {
- ret = PTR_ERR(priv->rst);
- dev_err(dev, "reset_get_by_name(rst) failed: %s\n", strerror(-ret));
- return ret;
+ dev_err(dev, "reset_get_by_name(rst) failed: %pe\n", priv->rst);
+ return PTR_ERR(priv->rst);
}
phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0);
diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 635be02929a5..b1a77a163798 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -277,9 +277,8 @@ static int imx_chipidea_probe(struct device_d *dev)
if (of_property_read_bool(dev->device_node, "fsl,usbphy")) {
ci->phy = of_phy_get_by_phandle(dev, "fsl,usbphy", 0);
if (IS_ERR(ci->phy)) {
- ret = PTR_ERR(ci->phy);
- dev_err(dev, "Cannot get phy: %s\n", strerror(-ret));
- return ret;
+ dev_err(dev, "Cannot get phy: %pe\n", ci->phy);
+ return PTR_ERR(ci->phy);
} else {
ci->usbphy = phy_to_usbphy(ci->phy);
if (IS_ERR(ci->usbphy))
diff --git a/drivers/video/imx-ipu-v3/ipu-common.c b/drivers/video/imx-ipu-v3/ipu-common.c
index 1811e50227b6..b31edcdd5561 100644
--- a/drivers/video/imx-ipu-v3/ipu-common.c
+++ b/drivers/video/imx-ipu-v3/ipu-common.c
@@ -804,9 +804,8 @@ static int ipu_probe(struct device_d *dev)
ipu->clk = clk_get(dev, "bus");
if (IS_ERR(ipu->clk)) {
- ret = PTR_ERR(ipu->clk);
- dev_err(dev, "clk_get failed: %s\n", strerror(-ret));
- return ret;
+ dev_err(dev, "clk_get failed: %pe\n", ipu->clk);
+ return PTR_ERR(ipu->clk);
}
dev->priv = ipu;
diff --git a/lib/cmdlinepart.c b/lib/cmdlinepart.c
index 5a164628749f..5e95760bae94 100644
--- a/lib/cmdlinepart.c
+++ b/lib/cmdlinepart.c
@@ -30,7 +30,6 @@ int cmdlinepart_do_parse_one(const char *devname, const char *partstr,
char *end;
char buf[PATH_MAX] = {};
unsigned long flags = 0;
- int ret = 0;
struct cdev *cdev;
memset(buf, 0, PATH_MAX);
@@ -85,11 +84,11 @@ int cmdlinepart_do_parse_one(const char *devname, const char *partstr,
cdev = devfs_add_partition(devname, *offset, size, flags, buf);
if (IS_ERR(cdev)) {
- ret = PTR_ERR(cdev);
- printf("cannot create %s: %s\n", buf, strerror(-ret));
+ printf("cannot create %s: %pe\n", buf, cdev);
+ return PTR_ERR(cdev);
}
- return ret;
+ return 0;
}
int cmdlinepart_do_parse(const char *devname, const char *parts, loff_t devsize,
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] vsprintf: constify pointers where appropriate
2020-09-28 15:34 [PATCH 1/4] vsprintf: constify pointers where appropriate Ahmad Fatoum
` (2 preceding siblings ...)
2020-09-28 15:34 ` [PATCH 4/4] treewide: replace strerror(-PTR_ERR(errno)) with %pe format specifier Ahmad Fatoum
@ 2020-09-29 6:42 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2020-09-29 6:42 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Sep 28, 2020 at 05:34:28PM +0200, Ahmad Fatoum wrote:
> No functional change, but makes code bit more future proof when it is
> extended.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> lib/vsprintf.c | 25 +++++++++++++++----------
> 1 file changed, 15 insertions(+), 10 deletions(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-29 6:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 15:34 [PATCH 1/4] vsprintf: constify pointers where appropriate Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 2/4] vsprintf: add %pe format specifier for printing symbolic error names Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 3/4] vsprintf: retire strerrorp in favor of %pe Ahmad Fatoum
2020-09-28 15:34 ` [PATCH 4/4] treewide: replace strerror(-PTR_ERR(errno)) with %pe format specifier Ahmad Fatoum
2020-09-29 6:42 ` [PATCH 1/4] vsprintf: constify pointers where appropriate Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox