summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-01-27 11:16:58 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-01-27 17:34:54 -0800
commit4b27be1223b048322398e04fcebef7f85c0dac0d (patch)
tree68fbd13d0a3c1459a1e40135d65cbee9bb36c1e4
parent2df6396160b019d992241e2db8a6d5a15f654e69 (diff)
downloadop-kernel-dev-4b27be1223b048322398e04fcebef7f85c0dac0d.zip
op-kernel-dev-4b27be1223b048322398e04fcebef7f85c0dac0d.tar.gz
greybus: audio_codec: Free gccodec on dia probe failure
We aren't freeing the codec, that we allocated before failing to probe the connection. Free it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r--drivers/staging/greybus/audio_codec.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index a7ccaaa..5fef495 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -789,6 +789,7 @@ static int gbaudio_dai_probe(struct gb_connection *connection)
int dev_id = connection->intf->interface_id;
struct gbaudio_codec_info *gbcodec = dev_get_drvdata(dev);
struct gb_audio_manager_module_descriptor desc;
+ int ret;
dev_dbg(dev, "Add DAI device:%d:%s\n", dev_id, dev_name(dev));
@@ -800,8 +801,10 @@ static int gbaudio_dai_probe(struct gb_connection *connection)
/* add/update dai_list*/
dai = gbaudio_add_dai(gbcodec, connection->intf_cport_id, connection,
NULL);
- if (!dai)
- return -ENOMEM;
+ if (!dai) {
+ ret = -ENOMEM;
+ goto err_free_codec;
+ }
/* update dai_added count */
mutex_lock(&gbcodec->lock);
@@ -825,6 +828,10 @@ static int gbaudio_dai_probe(struct gb_connection *connection)
mutex_unlock(&gbcodec->lock);
return 0;
+
+err_free_codec:
+ gbaudio_free_codec(dev, gbcodec);
+ return ret;
}
static void gbaudio_dai_remove(struct gb_connection *connection)
OpenPOWER on IntegriCloud