[OpenWrt-Devel] [PATCH 2/2 netifd] proto-shell: return error in case setup fails
Hans Dedecker
dedeckeh at gmail.com
Mon Apr 1 07:35:02 EDT 2019
On Mon, Apr 1, 2019 at 11:25 AM Jo-Philipp Wich <jo at mein.io> wrote:
>
> Hi,
>
> minor nitpick below....
>
> On 4/1/19 10:34 AM, Hans Dedecker wrote:
> > In case PROTO_CMD_SETUP cannot be handled due to an invalid state; return
> > -1 so the calling functions are aware the PROTO_CMD_SETUP has failed.
> >
> > Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
> > ---
> > proto-shell.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/proto-shell.c b/proto-shell.c
> > index 9653f4c..fd9cad4 100644
> > --- a/proto-shell.c
> > +++ b/proto-shell.c
> > @@ -184,8 +184,6 @@ proto_shell_handler(struct interface_proto_state *proto,
> > case S_SETUP_ABORT:
> > case S_TEARDOWN:
> > case S_SETUP:
> > - return 0;
> > -
>
> If I'm reading this correctly, this would join the above cases with the
> default case, so it is probably better to either drop the other "case"
> statements and only leave the "default:" one or to keep explicit
> redundancy by having two "return -1".
Correct this joins the above cases with the default cases. For
readability I agree it would be better to drop the other "case"
statements; I will send a follow-up patch
Hans
>
> > default:
> > return -1;
> > }
> >
>
>
> ~ Jo
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list