Re: [RFC 4/7][PATCH] AMBA DMA: Add a driver module for the DMA controller.

From: Roland Dreier
Date: Mon Oct 30 2006 - 12:25:29 EST


> this looks very very wrong to me.

Yes, the module reference counting needs to be completely redone.
This try_find_module() function is only used as:

> + pl080_driver.drv.owner = try_find_module(MODULE_NAME);

which as far as I can see should just be

pl080_driver.drv.owner = THIS_MODULE;

But there's also stuff like

> +static int pl080_request(dmach_t cnum, dma_t * cdata){
> + int retval = -EINVAL;
> +
> + /* Increase the usage */
> + if(try_module_get(pl080_driver.drv.owner)){
> + retval = 0;
> + }

which of course can never work -- this is inside the pl080 module so
it's already too late to take a reference.

The module refcounting just needs to be rethought.

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