aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-11-19 17:10:55 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:10:55 +0000
commit3c55e0e19b71483f20604966dcdc6dc765c9a436 (patch)
treec3bd68430a0bbedee29e1bbaef886b374072bc6e /sound
parent0ec4c9fcd85e3a1001444e480b335d5423c8761f (diff)
ASoC: Fix an error path in neo1973_wm8753
The error handling in neo1973_init is incorrect: * If platform_device_add fails, we go on with the rest of the initialization instead of bailing out. Things will break when the module is removed (platform_device_unregister called on a device that wasn't registered.) * If i2c_add_driver fails, we return an error so the module will not load, but we don't unregister neo1973_snd_device, so we are leaking resources. Add the missing error handling. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Tim Niemeyer <reddog@mastersword.de> Cc: Graeme Gregory <graeme@openmoko.org> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/s3c24xx/neo1973_wm8753.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
index 5cbbe988e1f..4ac2aae5ca0 100644
--- a/sound/soc/s3c24xx/neo1973_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -698,9 +698,10 @@ static int __init neo1973_init(void)
}
ret = i2c_add_driver(&lm4857_i2c_driver);
-
- if (ret != 0)
+ if (ret != 0) {
+ printk(KERN_ERR "can't add i2c driver");
platform_device_unregister(neo1973_snd_device);
+ }
return ret;
}