Skip to contentSkip to conversation

release_resource() check for NULL resource

PATCH Bodo Eggert 2 participants 2 messages Oct 4, 2005 – Oct 5, 2005 6 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 6 lines · Pekka Enberg

static int driver_init(void)

{
     dev->resource1 = request_region(...);
     if (!dev->resource1)
             goto failed;
Quoted 7 lines

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.

Signature · 2 lines
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.
#7 lore raw
Quoted 10 lines · Bodo Eggert
Quoted 8 lines · Pekka Enberg

static int driver_init(void)

{
     dev->resource1 = request_region(...);
     if (!dev->resource1)
             goto failed;

failed:

     driver_release(dev);
Quoted 7 lines
Quoted 4 lines

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_.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core