On Fri, 2010-11-05 at 10:07 -0400, Mark Brown wrote:
On Fri, Nov 05, 2010 at 01:59:51PM +0000, Dimitris Papastamos wrote:
On Fri, 2010-11-05 at 09:31 -0400, Mark Brown wrote:
Are you absolutely positive that every user of the code is using a register cache initialised using that method?
If people don't want to use our caching API, then if they need so they will have to manage that locally somewhere in the driver code. In that scenario, they will not call snd_soc_codec_set_cache_io() and they will have to set the codec->read() and codec->write() to point to their own implementation. They should also not set reg_cache_size and reg_word_size.
My concern is that since nothing stops people mix'n'matching currently someone may be using one bit and not the other - we need to audit all the current drivers to make sure that nothing is going to explode.
The previous caching code had the same issue. If someone called snd_soc_codec_set_cache_io() and they had not provided a valid reg_cache_size and reg_word_size (both of them were zero), the underlying codec->reg_cache would have been NULL and therefore any read()/write() operations going through soc-cache.c would result in an invalid access.
They could be setting these up later, or otherwise initialising. It's likely that nobody is but it's ringing an alarm bell that we need to audit in case there's something that's going to bite us later on.
Yup sure, it'd be wise to audit the codecs for any invalid use of the caching API.
Thanks, Dimitrios