Merge "swr-wcd-ctrl: set pointer to null after kfree"
This commit is contained in:
commit
a64efebb3c
6 changed files with 43 additions and 7 deletions
|
@ -741,6 +741,7 @@ static int wcd9xxx_irq_remove(struct platform_device *pdev)
|
||||||
wmb();
|
wmb();
|
||||||
irq_domain_remove(data->domain);
|
irq_domain_remove(data->domain);
|
||||||
kfree(data);
|
kfree(data);
|
||||||
|
domain->host_data = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,6 +325,7 @@ static int swrm_set_ch_map(struct swr_mstr_ctrl *swrm, void *data)
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!swrm->mstr_port->port) {
|
if (!swrm->mstr_port->port) {
|
||||||
kfree(swrm->mstr_port);
|
kfree(swrm->mstr_port);
|
||||||
|
swrm->mstr_port = NULL;
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memcpy(swrm->mstr_port->port, pinfo->port, pinfo->num_port);
|
memcpy(swrm->mstr_port->port, pinfo->port, pinfo->num_port);
|
||||||
|
@ -1474,7 +1475,9 @@ static int swrm_remove(struct platform_device *pdev)
|
||||||
swrm, SWR_IRQ_FREE);
|
swrm, SWR_IRQ_FREE);
|
||||||
if (swrm->mstr_port) {
|
if (swrm->mstr_port) {
|
||||||
kfree(swrm->mstr_port->port);
|
kfree(swrm->mstr_port->port);
|
||||||
|
swrm->mstr_port->port = NULL;
|
||||||
kfree(swrm->mstr_port);
|
kfree(swrm->mstr_port);
|
||||||
|
swrm->mstr_port = NULL;
|
||||||
}
|
}
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
pm_runtime_set_suspended(&pdev->dev);
|
pm_runtime_set_suspended(&pdev->dev);
|
||||||
|
|
|
@ -8956,8 +8956,11 @@ static int tomtom_codec_probe(struct snd_soc_codec *codec)
|
||||||
|
|
||||||
err_pdata:
|
err_pdata:
|
||||||
kfree(ptr);
|
kfree(ptr);
|
||||||
|
control->rx_chs = NULL;
|
||||||
|
control->tx_chs = NULL;
|
||||||
err_hwdep:
|
err_hwdep:
|
||||||
kfree(tomtom->fw_data);
|
kfree(tomtom->fw_data);
|
||||||
|
tomtom->fw_data = NULL;
|
||||||
err_nomem_slimch:
|
err_nomem_slimch:
|
||||||
devm_kfree(codec->dev, tomtom);
|
devm_kfree(codec->dev, tomtom);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -8965,12 +8968,17 @@ err_nomem_slimch:
|
||||||
static int tomtom_codec_remove(struct snd_soc_codec *codec)
|
static int tomtom_codec_remove(struct snd_soc_codec *codec)
|
||||||
{
|
{
|
||||||
struct tomtom_priv *tomtom = snd_soc_codec_get_drvdata(codec);
|
struct tomtom_priv *tomtom = snd_soc_codec_get_drvdata(codec);
|
||||||
|
struct wcd9xxx *control;
|
||||||
|
|
||||||
WCD9XXX_BG_CLK_LOCK(&tomtom->resmgr);
|
WCD9XXX_BG_CLK_LOCK(&tomtom->resmgr);
|
||||||
atomic_set(&kp_tomtom_priv, 0);
|
atomic_set(&kp_tomtom_priv, 0);
|
||||||
|
|
||||||
WCD9XXX_BG_CLK_UNLOCK(&tomtom->resmgr);
|
WCD9XXX_BG_CLK_UNLOCK(&tomtom->resmgr);
|
||||||
|
|
||||||
|
control = dev_get_drvdata(codec->dev->parent);
|
||||||
|
control->rx_chs = NULL;
|
||||||
|
control->tx_chs = NULL;
|
||||||
|
|
||||||
if (tomtom->wcd_ext_clk)
|
if (tomtom->wcd_ext_clk)
|
||||||
clk_put(tomtom->wcd_ext_clk);
|
clk_put(tomtom->wcd_ext_clk);
|
||||||
tomtom_cleanup_irqs(tomtom);
|
tomtom_cleanup_irqs(tomtom);
|
||||||
|
|
|
@ -13357,8 +13357,11 @@ static int tasha_codec_probe(struct snd_soc_codec *codec)
|
||||||
|
|
||||||
err_pdata:
|
err_pdata:
|
||||||
devm_kfree(codec->dev, ptr);
|
devm_kfree(codec->dev, ptr);
|
||||||
|
control->rx_chs = NULL;
|
||||||
|
control->tx_chs = NULL;
|
||||||
err_hwdep:
|
err_hwdep:
|
||||||
devm_kfree(codec->dev, tasha->fw_data);
|
devm_kfree(codec->dev, tasha->fw_data);
|
||||||
|
tasha->fw_data = NULL;
|
||||||
err:
|
err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -13366,6 +13369,11 @@ err:
|
||||||
static int tasha_codec_remove(struct snd_soc_codec *codec)
|
static int tasha_codec_remove(struct snd_soc_codec *codec)
|
||||||
{
|
{
|
||||||
struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
|
struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
|
||||||
|
struct wcd9xxx *control;
|
||||||
|
|
||||||
|
control = dev_get_drvdata(codec->dev->parent);
|
||||||
|
control->rx_chs = NULL;
|
||||||
|
control->tx_chs = NULL;
|
||||||
|
|
||||||
tasha_cleanup_irqs(tasha);
|
tasha_cleanup_irqs(tasha);
|
||||||
/* Cleanup MBHC */
|
/* Cleanup MBHC */
|
||||||
|
|
|
@ -5556,6 +5556,8 @@ static int tavil_soc_codec_probe(struct snd_soc_codec *codec)
|
||||||
|
|
||||||
err_pdata:
|
err_pdata:
|
||||||
devm_kfree(codec->dev, ptr);
|
devm_kfree(codec->dev, ptr);
|
||||||
|
control->rx_chs = NULL;
|
||||||
|
control->tx_chs = NULL;
|
||||||
err:
|
err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -5567,6 +5569,8 @@ static int tavil_soc_codec_remove(struct snd_soc_codec *codec)
|
||||||
|
|
||||||
control = dev_get_drvdata(codec->dev->parent);
|
control = dev_get_drvdata(codec->dev->parent);
|
||||||
devm_kfree(codec->dev, control->rx_chs);
|
devm_kfree(codec->dev, control->rx_chs);
|
||||||
|
control->rx_chs = NULL;
|
||||||
|
control->tx_chs = NULL;
|
||||||
tavil_cleanup_irqs(tavil);
|
tavil_cleanup_irqs(tavil);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -200,28 +200,40 @@ int msm_gpioset_initialize(enum pinctrl_client client,
|
||||||
err:
|
err:
|
||||||
/* Free up memory allocated for gpio set combinations */
|
/* Free up memory allocated for gpio set combinations */
|
||||||
for (i = 0; i < gpioset_info[client].gpiosets_max; i++) {
|
for (i = 0; i < gpioset_info[client].gpiosets_max; i++) {
|
||||||
if (NULL != gpioset_info[client].gpiosets[i])
|
if (gpioset_info[client].gpiosets[i] != NULL) {
|
||||||
devm_kfree(dev, gpioset_info[client].gpiosets[i]);
|
devm_kfree(dev, gpioset_info[client].gpiosets[i]);
|
||||||
|
gpioset_info[client].gpiosets[i] = NULL;
|
||||||
}
|
}
|
||||||
if (NULL != gpioset_info[client].gpiosets)
|
}
|
||||||
|
if (gpioset_info[client].gpiosets != NULL) {
|
||||||
devm_kfree(dev, gpioset_info[client].gpiosets);
|
devm_kfree(dev, gpioset_info[client].gpiosets);
|
||||||
|
gpioset_info[client].gpiosets = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Free up memory allocated for gpio set combinations */
|
/* Free up memory allocated for gpio set combinations */
|
||||||
for (i = 0; i < gpioset_info[client].gpiosets_comb_max; i++) {
|
for (i = 0; i < gpioset_info[client].gpiosets_comb_max; i++) {
|
||||||
if (NULL != gpioset_info[client].gpiosets_comb_names[i])
|
if (gpioset_info[client].gpiosets_comb_names[i] != NULL) {
|
||||||
devm_kfree(dev,
|
devm_kfree(dev,
|
||||||
gpioset_info[client].gpiosets_comb_names[i]);
|
gpioset_info[client].gpiosets_comb_names[i]);
|
||||||
|
gpioset_info[client].gpiosets_comb_names[i] = NULL;
|
||||||
}
|
}
|
||||||
if (NULL != gpioset_info[client].gpiosets_comb_names)
|
}
|
||||||
|
if (gpioset_info[client].gpiosets_comb_names != NULL) {
|
||||||
devm_kfree(dev, gpioset_info[client].gpiosets_comb_names);
|
devm_kfree(dev, gpioset_info[client].gpiosets_comb_names);
|
||||||
|
gpioset_info[client].gpiosets_comb_names = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Free up memory allocated for handles to pinctrl states */
|
/* Free up memory allocated for handles to pinctrl states */
|
||||||
if (NULL != pinctrl_info[client].cdc_lines)
|
if (pinctrl_info[client].cdc_lines != NULL) {
|
||||||
devm_kfree(dev, pinctrl_info[client].cdc_lines);
|
devm_kfree(dev, pinctrl_info[client].cdc_lines);
|
||||||
|
pinctrl_info[client].cdc_lines = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Free up memory allocated for counter of gpio sets */
|
/* Free up memory allocated for counter of gpio sets */
|
||||||
if (NULL != gpioset_info[client].gpioset_state)
|
if (gpioset_info[client].gpioset_state != NULL) {
|
||||||
devm_kfree(dev, gpioset_info[client].gpioset_state);
|
devm_kfree(dev, gpioset_info[client].gpioset_state);
|
||||||
|
gpioset_info[client].gpioset_state = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
success:
|
success:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue