summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/ak4535.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2009-04-06 05:50:46 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-04-06 13:53:37 +0400
commit09318c47b6121c8d18cee50ca7e270a8b7dfd274 (patch)
treec63f57d625b19c869765fa6ba949d6b3821dbc7b /sound/soc/codecs/ak4535.c
parent103f211d0be2bed75b5739de62a10415ef0bbc25 (diff)
downloadlinux-09318c47b6121c8d18cee50ca7e270a8b7dfd274.tar.xz
ASoC: Fix null dereference in ak4535_remove()
ak4535_remove() from sound/soc/codecs/ak4535.c calls i2c_unregister_device() with a possibly null pointer. This bug was found by smatch (http://repo.or.cz/w/smatch.git/). Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/ak4535.c')
-rw-r--r--sound/soc/codecs/ak4535.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index 1f63d387a2f4..dd3380202766 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -659,7 +659,8 @@ static int ak4535_remove(struct platform_device *pdev)
snd_soc_free_pcms(socdev);
snd_soc_dapm_free(socdev);
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
- i2c_unregister_device(codec->control_data);
+ if (codec->control_data)
+ i2c_unregister_device(codec->control_data);
i2c_del_driver(&ak4535_i2c_driver);
#endif
kfree(codec->private_data);