Displaying 2 results from an estimated 2 matches for "out_foo".
2016 Aug 22
5
[PATCH] CodingStyle: add some more error handling guidelines
...is is to split it up into two error labels "err_bar:" and "err_foo:".
+Note that labels normally come before the appropriate cleanups:
+
+ foo = kmalloc(SIZE, GFP_KERNEL);
+ if (!foo)
+ goto out;
+
+ foo->bar = kmalloc(SIZE, GFP_KERNEL);
+ if (!foo->bar)
+ goto out_foo;
+ ...
+ if (err)
+ goto out_bar;
+
+ out_bar:
+ kfree(foo->bar);
+
+ out_foo:
+ kfree(foo);
+
+ out:
+ return ret;
+
+If labels are named after the goto location (or error that was detected), they
+come after the matching cleanup code:
+
+ foo = kmalloc(SIZE, GFP_KERNEL);
+ if (!foo)...
2016 Aug 22
5
[PATCH] CodingStyle: add some more error handling guidelines
...is is to split it up into two error labels "err_bar:" and "err_foo:".
+Note that labels normally come before the appropriate cleanups:
+
+ foo = kmalloc(SIZE, GFP_KERNEL);
+ if (!foo)
+ goto out;
+
+ foo->bar = kmalloc(SIZE, GFP_KERNEL);
+ if (!foo->bar)
+ goto out_foo;
+ ...
+ if (err)
+ goto out_bar;
+
+ out_bar:
+ kfree(foo->bar);
+
+ out_foo:
+ kfree(foo);
+
+ out:
+ return ret;
+
+If labels are named after the goto location (or error that was detected), they
+come after the matching cleanup code:
+
+ foo = kmalloc(SIZE, GFP_KERNEL);
+ if (!foo)...