Skip to content

Commit

Permalink
ASoC: Fix null dereference in ak4535_remove()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Mark Brown committed Apr 6, 2009
1 parent 103f211 commit 09318c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sound/soc/codecs/ak4535.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 09318c4

Please sign in to comment.