summaryrefslogtreecommitdiffstats
path: root/common/env.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-04-28 12:43:02 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-05-04 09:27:35 +0200
commit6d4afd96fc94a3f2d256ef4e8d7c9687a145a701 (patch)
tree4178e2a5631795028e20907dd916a49dd6626b75 /common/env.c
parent10bb13e7fdf4d1417a5f537b8ef00ded9502c0b9 (diff)
downloadbarebox-6d4afd96fc94a3f2d256ef4e8d7c9687a145a701.tar.gz
setenv: Be more informative when device parameter setting fails
When setting a device parameter fails not only the error code is of interest, but also what the parameter name is, what the device name is and whether a device was found for this name. Add this information to the error message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/env.c')
-rw-r--r--common/env.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/common/env.c b/common/env.c
index 2e33eb3..c98ed73 100644
--- a/common/env.c
+++ b/common/env.c
@@ -218,16 +218,18 @@ int setenv(const char *_name, const char *value)
*par++ = 0;
dev = get_device_by_name(name);
- if (dev)
+ if (dev) {
ret = dev_set_param(dev, par, value);
- else
+ if (ret)
+ eprintf("%s: set parameter %s: %s\n",
+ dev_name(dev), par, strerror(-ret));
+ } else {
ret = -ENODEV;
+ eprintf("set parameter: no such device %s\n", name);
+ }
errno = -ret;
- if (ret < 0)
- perror("set parameter");
-
goto out;
}