[PATCH] common: env: make error message more verbose

Steffen Trumtrar s.trumtrar at pengutronix.de
Mon May 4 00:43:59 PDT 2015


Hi!

On Mon, May 04, 2015 at 09:32:19AM +0200, Sascha Hauer wrote:
> On Tue, Apr 28, 2015 at 12:32:27PM +0200, Steffen Trumtrar wrote:
> > Change the setenv error message from
> > 
> > 	set parameter: Invalid argument
> > 
> > to a more helpful
> > 
> > 	net: cannot set parameter 'nameserver': Invalid argument
> > 
> > Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
> > ---
> >  common/env.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/common/env.c b/common/env.c
> > index 2e33eb35856b..434170a7468b 100644
> > --- a/common/env.c
> > +++ b/common/env.c
> > @@ -225,8 +225,10 @@ int setenv(const char *_name, const char *value)
> >  
> >  		errno = -ret;
> >  
> > -		if (ret < 0)
> > -			perror("set parameter");
> > +		if (ret < 0) {
> > +			dev_err(dev, "cannot set parameter '%s'", par);
> > +			perror("");
> > +		}
> 
> dev may be invalid here, so you shouldn't use dev_err.
> 

Argh, yeah, of course *facepalm*.

> After we talked about the missing informations in the setenv failure
> path I created the following patch. I applied this one now.

Thanks for fixing.
Steffen

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list