devfreq: devfreq_spdm: Correct Memory usages check in error cases
Correct some of memory free usages check to avoid corruption later point of time. Change-Id: Iaeff7bf413157ff324d1678f630de54c22d792a0 Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
This commit is contained in:
parent
5102def78e
commit
384511e2a0
1 changed files with 7 additions and 1 deletions
|
@ -202,6 +202,7 @@ static int populate_config_data(struct spdm_data *data,
|
||||||
data->config_data.num_ports);
|
data->config_data.num_ports);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
devm_kfree(&pdev->dev, data->config_data.ports);
|
devm_kfree(&pdev->dev, data->config_data.ports);
|
||||||
|
data->config_data.ports = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,6 +239,7 @@ static int populate_spdm_data(struct spdm_data *data,
|
||||||
no_client:
|
no_client:
|
||||||
no_pdata:
|
no_pdata:
|
||||||
devm_kfree(&pdev->dev, data->config_data.ports);
|
devm_kfree(&pdev->dev, data->config_data.ports);
|
||||||
|
data->config_data.ports = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +298,7 @@ static int probe(struct platform_device *pdev)
|
||||||
devfreq_add_device(&pdev->dev, data->profile, "spdm_bw_hyp", data);
|
devfreq_add_device(&pdev->dev, data->profile, "spdm_bw_hyp", data);
|
||||||
if (IS_ERR(data->devfreq)) {
|
if (IS_ERR(data->devfreq)) {
|
||||||
ret = PTR_ERR(data->devfreq);
|
ret = PTR_ERR(data->devfreq);
|
||||||
goto no_profile;
|
goto no_spdm_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
spdm_init_debugfs(&pdev->dev);
|
spdm_init_debugfs(&pdev->dev);
|
||||||
|
@ -311,6 +313,8 @@ static int probe(struct platform_device *pdev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
no_spdm_device:
|
||||||
|
devm_kfree(&pdev->dev, data->profile);
|
||||||
no_profile:
|
no_profile:
|
||||||
no_clock:
|
no_clock:
|
||||||
msm_bus_scale_unregister_client(data->bus_scale_client_id);
|
msm_bus_scale_unregister_client(data->bus_scale_client_id);
|
||||||
|
@ -318,6 +322,7 @@ no_bus_scaling:
|
||||||
devm_kfree(&pdev->dev, data->config_data.ports);
|
devm_kfree(&pdev->dev, data->config_data.ports);
|
||||||
bad_of:
|
bad_of:
|
||||||
devm_kfree(&pdev->dev, data);
|
devm_kfree(&pdev->dev, data);
|
||||||
|
platform_set_drvdata(pdev, NULL);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +347,7 @@ static int remove(struct platform_device *pdev)
|
||||||
devm_kfree(&pdev->dev, data->config_data.ports);
|
devm_kfree(&pdev->dev, data->config_data.ports);
|
||||||
|
|
||||||
devm_kfree(&pdev->dev, data);
|
devm_kfree(&pdev->dev, data);
|
||||||
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
if (spdm_ipc_log_ctxt)
|
if (spdm_ipc_log_ctxt)
|
||||||
ipc_log_context_destroy(spdm_ipc_log_ctxt);
|
ipc_log_context_destroy(spdm_ipc_log_ctxt);
|
||||||
|
|
Loading…
Add table
Reference in a new issue