Re: [patch] CodingStyle: add some more error handling guidelines

From: Arend van Spriel
Date: Wed Dec 03 2014 - 09:08:12 EST


On 12/03/14 14:24, SF Markus Elfring wrote:
Sorry. I misread your email. If the code looks like this:

foo = kmalloc();
if (!foo)
goto kmalloc_failed;

The "kmalloc_failed" doesn't add any information.

I find that this such a name approach would fit to your
expectation of a source-oriented labeling of these identifiers.


We can see that kmalloc failed from the context.

Which name pattern do you find more appropriate in such
an use case?

I think Dan wants the label to be descriptive about the tasks needed in the exception handling itself. This makes sense as the exception handling steps may be reused for different failures in the code.

void foo(void)
{
if (check_a())
goto do_bar;

sub_foo1();

if (checck_b())
goto do_bar;

sub_foo2();
return;

do_bar:
bar();
}

Regards,
Arend

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/