Re: question on common error-handling idiom

From: GNicz
Date: Wed Nov 03 2004 - 03:08:42 EST


Some code parts is using diffirent error handling.

if(err1) {
clenup1;
return -ERR1;
}

...

if(err2) {
cleanup2;
return -ERR2;
}

Shouldn't it be converted into:

err = -ERR1;
if(err1)
goto cleanup1;

...

err = -ERR2;
if(err2)
goto cleanup2;

I think there should be one methond, which will be used in all kernel code.

Regards, GNicz
-
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/