Re: [PATCH] release_resource() check for NULL resource

From: Pekka Enberg
Date: Mon Oct 03 2005 - 09:58:54 EST


Hi,

On Mon, Oct 03, 2005 at 03:43:50PM +0300, Pekka Enberg wrote:
> > Many drivers have the release function copy-pasted to init with lots
> > of goto labels exactly because release_region, iounmap, and friends
> > aren't NULL safe.

On Mon, 2005-10-03 at 14:42 +0100, Al Viro wrote:
> Bullshit. I have waded through many, *many* initialization sequences
> like that. "Lots of goto labels" is _less_ prone to breakage when
> properly done; your variant begs for trouble upon the driver changes.
>
> Note that "lots of goto" is actually a cleaner control structure than
> what you propose - the amount of instances of offending statement is
> far from being the only metrics. The only things to verify with it are

Fair enough. Bad example from my part.

My main argument still remains. It is useful to handle NULL in some
release functions (iounmap and release_resource come to mind) because it
simplifies releasing a partially initialized state. Grep for NULL checks
around iounmap() and release_resource() calls for existing usage in the
drivers...

Pekka

-
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/