[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130117.154240.1134435647038964241.davem@davemloft.net>
Date: Thu, 17 Jan 2013 15:42:40 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: jiri@...nulli.us
Cc: stephen@...workplumber.org, netdev@...r.kernel.org
Subject: Re: [patch net-next] team: do not use -ENOENT
From: Jiri Pirko <jiri@...nulli.us>
Date: Thu, 17 Jan 2013 21:33:47 +0100
>>> @@ -2320,7 +2320,7 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
>>> list_add(&opt_inst->tmp_list, &opt_inst_list);
>>> }
>>> if (!opt_found) {
>>> - err = -ENOENT;
>>> + err = -EINVAL;
>>> goto team_put;
>>> }
>>> }
> I'm not really sure. But in this case, I do not think that is a problem.
>
> 1) I'm most probably the only one (libteam) who is using this api and
> libteam does not mind about what err code is returned in these cases.
>
> 2) In this case, it is only about different number. And one number or
> another, it does not imply userspace to behave differently. In other words,
> userspace should not take different actions in case for example -ENOENT
> or -ENODEV is returned.
I agree with this analysis.
But for the team_nl_cmd_options_set() case, I would strongly advise
that you use some error code more descriptive than -EINVAL. In fact
the existing -ENOENT I feel is better, because it tells the caller
what kind of problem there was.
Even if you don't like the fact that -ENOENT is oriented towards file
existence, it does convey a ton more information than -EINVAL does.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists