bluetooth: Fix free data pointer routine

Data pointer has been reused after freed it. So,
it has been moved to after using the data pointer
to clean up resource and freed it.

Change-Id: Ibc94e092134ff1f36e896c679ade7f639254a24d
Signed-off-by: Sungjun Park <sjpark@codeaurora.org>
This commit is contained in:
Sungjun Park 2017-01-23 13:28:44 -08:00 committed by Gerrit - the friendly Code Review server
parent dd09cbba26
commit e02e63b801

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -512,7 +512,6 @@ static int btfm_slim_remove(struct slim_device *slim)
BTFMSLIM_DBG("");
mutex_destroy(&btfm_slim->io_lock);
mutex_destroy(&btfm_slim->xfer_lock);
kfree(btfm_slim);
snd_soc_unregister_codec(&slim->dev);
BTFMSLIM_DBG("slim_remove_device() - btfm_slim->slim_ifd");
@ -520,6 +519,8 @@ static int btfm_slim_remove(struct slim_device *slim)
BTFMSLIM_DBG("slim_remove_device() - btfm_slim->slim_pgd");
slim_remove_device(slim);
kfree(btfm_slim);
return 0;
}