diff options
-rw-r--r-- | sound/soc/codecs/wm8940.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index e3c4bbfaae27..f0c11138e610 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
@@ -845,6 +845,7 @@ static void wm8940_unregister(struct wm8940_priv *wm8940) | |||
845 | static int wm8940_i2c_probe(struct i2c_client *i2c, | 845 | static int wm8940_i2c_probe(struct i2c_client *i2c, |
846 | const struct i2c_device_id *id) | 846 | const struct i2c_device_id *id) |
847 | { | 847 | { |
848 | int ret; | ||
848 | struct wm8940_priv *wm8940; | 849 | struct wm8940_priv *wm8940; |
849 | struct snd_soc_codec *codec; | 850 | struct snd_soc_codec *codec; |
850 | 851 | ||
@@ -858,7 +859,11 @@ static int wm8940_i2c_probe(struct i2c_client *i2c, | |||
858 | codec->control_data = i2c; | 859 | codec->control_data = i2c; |
859 | codec->dev = &i2c->dev; | 860 | codec->dev = &i2c->dev; |
860 | 861 | ||
861 | return wm8940_register(wm8940, SND_SOC_I2C); | 862 | ret = wm8940_register(wm8940, SND_SOC_I2C); |
863 | if (ret < 0) | ||
864 | kfree(wm8940); | ||
865 | |||
866 | return ret; | ||
862 | } | 867 | } |
863 | 868 | ||
864 | static int __devexit wm8940_i2c_remove(struct i2c_client *client) | 869 | static int __devexit wm8940_i2c_remove(struct i2c_client *client) |