[PATCH 3/5] staging: vme: add functions for bridge module refcounting

Martyn Welch martyn.welch at ge.com
Mon Aug 22 12:24:59 UTC 2011


On 13/08/11 08:47, Emilio G. Cota wrote:
> On Fri, Aug 12, 2011 at 12:30:49 +0200, Manohar Vanga wrote:
>> +	struct vme_bridge *bridge;
>> +
>> +	mutex_lock(&vme_buses_lock);
>> +	list_for_each_entry(bridge, &vme_bus_list, bus_list) {
>> +		if (bridge->num == bus_id) {
>> +			if (!bridge->owner)
>> +				dev_warn(bridge->parent,
>> +					"bridge->owner not set\n");
> 
> Don't do this; it will throw a false warning if the kernel is
> built without module support. Note that in that case
> 
> 	THIS_MODULE == (struct module *)0.
> 
> try_module_get() and module_put() do the right thing for all
> possible configs. Trust them.
> 

I can confirm that this does break when the bridge is compiled into the kernel.

Martyn

-- 
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms                   | Wales (3828642) at 100
T +44(0)1327322748                         | Barbirolli Square, Manchester,
E martyn.welch at ge.com                      | M2 3AB  VAT:GB 927559189



More information about the devel mailing list