[PATCH 1/3] state: provide an error message when an error occurs

Juergen Borleis jbe at pengutronix.de
Thu Aug 17 01:16:17 PDT 2017


Hi Uwe,

On Thursday 17 August 2017 10:05:43 Uwe Kleine-König wrote:
> On Wed, Aug 16, 2017 at 02:27:07PM +0200, Juergen Borleis wrote:
> > A simple typo makes the state framework fail, but without an error
> > message the developer is lost in the dark.
> >
> > Signed-off-by: Juergen Borleis <jbe at pengutronix.de>
> > ---
> >  common/state/state.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/common/state/state.c b/common/state/state.c
> > index 121ba0c6d..fc822b21b 100644
> > --- a/common/state/state.c
> > +++ b/common/state/state.c
> > @@ -240,6 +240,7 @@ static int state_convert_node_variable(struct state
> > *state,
> >
> >  	vtype = state_find_type_by_name(type_name);
> >  	if (!vtype) {
> > +		dev_dbg(&state->dev, "Error: invalid variable type '%s'\n", type_name);
>
> I think this is only visible if you manually define DEBUG for state.
> Assuming this is right dev_dbg doesn't match your intention.

My intention is to enlighten the developer when she/he adds the state feature
to her/his machine. Its not intended for the enduser (which means the
developer already has made a bad work). So the required "#define DEBUG" is
intended.

Jürgen

-- 
Pengutronix e.K.                             | Juergen Borleis             |
Industrial Linux Solutions                   | http://www.pengutronix.de/  |



More information about the barebox mailing list