22 Oct
2010
22 Oct
'10
7:03 p.m.
On Fri, Oct 22, 2010 at 03:28:20PM +0100, Dimitris Papastamos wrote:
+static int snd_soc_cache_default_sync(struct snd_soc_codec *codec) +{
const u8 *cache;
struct snd_soc_codec_driver *codec_drv;
unsigned int val;
codec_drv = codec->driver;
for (n = 0; n < codec_drv->reg_cache_size; ++n) {
Please use i as an array index unless using something meaningful.
if (!memcmp(&val, cache, codec_drv->reg_word_size))
continue;
This memcmp() looks very suspicious - we're copying from an unsigned int into a variable of another type. That seems to have a bit of an endianness assumption, doesn't it? It certainly needs comments explaining how it works; a similar thing applies to the other memcpy() and memcmp() operations in the code.
+static int snd_soc_cache_default_deinit(struct snd_soc_codec *codec) +{
_exit or _free would be traditional.
- kfree(codec->reg_cache);
- return 0;
+};
Extra ; (I'm surprised nothing warns).