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

From: Russell King
Date: Wed Oct 05 2005 - 04:07:37 EST


On Wed, Oct 05, 2005 at 12:31:07AM +0200, Bodo Eggert wrote:
> Pekka Enberg <penberg@xxxxxxxxxxxxxx> wrote:
> > static int driver_init(void)
> > {
> > dev->resource1 = request_region(...);
> > if (!dev->resource1)
> > goto failed;
>
> > failed:
> > driver_release(dev);
>
> > static void driver_release(struct device * dev)
> > {
> > release_resource(dev->resource1);
> > release_resource(dev->resource2);
>
> If the dev struct* isn't properly initialized, it will try to free a random
> resource.

Fur christ sake, I've made this point several times in this thread and
it still seems to be missed. (or maybe it's just folks sloppy use of
English.)

release_resource does *not* free anything. It unregisters it from the
resource tree _only_.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
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/