- goto discard; + consume_skb(skb); + return 0;
if (foo() != 0) goto fail; goto fail;
Edited to add: 'goto fail' is a valid construct and can be used to handle finalization in C functions. Consider:
int foo(char *bar, int baz) { sometype_t *obj = NULL; int fd = -1; if ((obj = sometype_new(bar, baz)) == NULL) { goto fail; } if ((fd = open(sometype_path(obj), O_RDONLY)) < 0) { goto fail; } /* ... */ return 0; fail: if (fd < 0) { close(fd); } if (obj != NULL) { sometype_free(obj); } return -1; }