Commit 4b27be12 authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 2df63961
...@@ -789,6 +789,7 @@ static int gbaudio_dai_probe(struct gb_connection *connection) ...@@ -789,6 +789,7 @@ static int gbaudio_dai_probe(struct gb_connection *connection)
int dev_id = connection->intf->interface_id; int dev_id = connection->intf->interface_id;
struct gbaudio_codec_info *gbcodec = dev_get_drvdata(dev); struct gbaudio_codec_info *gbcodec = dev_get_drvdata(dev);
struct gb_audio_manager_module_descriptor desc; struct gb_audio_manager_module_descriptor desc;
int ret;
dev_dbg(dev, "Add DAI device:%d:%s\n", dev_id, dev_name(dev)); 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) ...@@ -800,8 +801,10 @@ static int gbaudio_dai_probe(struct gb_connection *connection)
/* add/update dai_list*/ /* add/update dai_list*/
dai = gbaudio_add_dai(gbcodec, connection->intf_cport_id, connection, dai = gbaudio_add_dai(gbcodec, connection->intf_cport_id, connection,
NULL); NULL);
if (!dai) if (!dai) {
return -ENOMEM; ret = -ENOMEM;
goto err_free_codec;
}
/* update dai_added count */ /* update dai_added count */
mutex_lock(&gbcodec->lock); mutex_lock(&gbcodec->lock);
...@@ -825,6 +828,10 @@ static int gbaudio_dai_probe(struct gb_connection *connection) ...@@ -825,6 +828,10 @@ static int gbaudio_dai_probe(struct gb_connection *connection)
mutex_unlock(&gbcodec->lock); mutex_unlock(&gbcodec->lock);
return 0; return 0;
err_free_codec:
gbaudio_free_codec(dev, gbcodec);
return ret;
} }
static void gbaudio_dai_remove(struct gb_connection *connection) static void gbaudio_dai_remove(struct gb_connection *connection)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment