Re: [PATCH 3/5 v8] OMAP: McBSP: Introduce caching in register write operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 Dec 2009 01:36:47 +0100
Janusz Krzysztofik <jkrzyszt@xxxxxxxxxxxx> wrote:

> 3. In omap_mcbsp_free(), marking the port as free before deallocating the 
>    cache, could result in memory leak as well.
> 
> I hope all are addressed correctly. Since releasing the port with
> 
> 	mcbsp->free = 1;
> 
> after kzalloc() failure should be atomic, I have assumed this doesn't require 
> locking.
> 
Good catch. One comment below.

> @@ -471,6 +491,9 @@ void omap_mcbsp_free(unsigned int id)
>  		free_irq(mcbsp->tx_irq, (void *)mcbsp);
>  	}
>  
> +	kfree(mcbsp->reg_cache);
> +	mcbsp->reg_cache = NULL;
> +
>  	spin_lock(&mcbsp->lock);
>  	if (mcbsp->free) {
>  		dev_err(mcbsp->dev, "McBSP%d was not reserved\n",

This is fine in current form but to play safe, lets do the kfree
inside the spin_lock section where the mcbsp->free is set. Then there
is no risk if some future code would use the mcbsp->free as a guard for
cache etc. access.


-- 
Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux