]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pnp/core.c
PNP: make pnp_resource_table private to PNP core
[linux-2.6-omap-h63xx.git] / drivers / pnp / core.c
index cf37701a4f9ee4f2f7e6aef734f37ecc13d4292b..20771b7d4482562d18536aca252f9e870b08f907 100644 (file)
@@ -106,6 +106,7 @@ static void pnp_release_device(struct device *dmdev)
        pnp_free_option(dev->independent);
        pnp_free_option(dev->dependent);
        pnp_free_ids(dev);
+       kfree(dev->res);
        kfree(dev);
 }
 
@@ -118,6 +119,12 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid
        if (!dev)
                return NULL;
 
+       dev->res = kzalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
+       if (!dev->res) {
+               kfree(dev);
+               return NULL;
+       }
+
        dev->protocol = protocol;
        dev->number = id;
        dev->dma_mask = DMA_24BIT_MASK;
@@ -133,6 +140,7 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid
 
        dev_id = pnp_add_id(dev, pnpid);
        if (!dev_id) {
+               kfree(dev->res);
                kfree(dev);
                return NULL;
        }