Re: goto???

2015-07-17 Thread Martin Knappe
you don't understand what we're talking about, please be quiet. Yes it's VERY EASY to rewrite that function without using gotos (see my first post). It is and remains correct. Am 17.07.2015 23:06 schrieb valdis.kletni...@vt.edu: > On Fri, 17 Jul 2015 10:48:53 +0200, Martin Knappe sai

Re: goto???

2015-07-17 Thread Martin Knappe
_flipbuf(brd); } if (cleanupState > 0) { dgap_cleanup_nodes(); dgap_unmap(brd); kfree(brd); } return rc; } Am 17.07.2015 11:31 schrieb Sudip Mukherjee: > On Fri, Jul 17, 2015 at 2:52 PM, Martin Knappe > wrote: >> I'm just messing ... >> I g

Re: goto???

2015-07-17 Thread Martin Knappe
jee: > On Fri, Jul 17, 2015 at 2:52 PM, Martin Knappe > wrote: >> I'm just messing ... >> I guess I felt a bit challenged by your "try to write that without >> using >> goto" > Hey, it was not a challenge. main thing is the readability. > But goin

Re: goto???

2015-07-17 Thread Martin Knappe
return statement. 2) Only ONE cleanup label to goto in case of an error. Call that label "finish", ALWAYS. Am 17.07.2015 11:13 schrieb Sudip Mukherjee: > On Fri, Jul 17, 2015 at 2:18 PM, Martin Knappe > wrote: >> Very easy: > Looks good. :) > But for me, now while readi

Re: goto???

2015-07-17 Thread Martin Knappe
Very easy: static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { int rc = 0; int cleanupState = 0; struct board_t *brd; void cleanup() { if (cleanupState > 4) { dgap_tty_free(brd); } if (cleanupState > 3) {