mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
msm: kgsl: Minor cleanups for kgsl bus probe
The KGSL bus probe was not quite resilient for a deferred probe. Move a memory allocation to devm and make sure that the interconnect handle is properly put away on failure. Change-Id: Ic0dedbad261c483a157161a43da0b54459ed46ff Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
parent
535241a5fb
commit
c7ae23947d
4 changed files with 27 additions and 25 deletions
|
|
@ -1462,10 +1462,8 @@ static int adreno_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
status = kgsl_bus_init(device, pdev);
|
||||
if (status) {
|
||||
device->pdev = NULL;
|
||||
return status;
|
||||
}
|
||||
if (status)
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* Probe/init GMU after initial gpu power probe
|
||||
|
|
@ -1473,10 +1471,8 @@ static int adreno_probe(struct platform_device *pdev)
|
|||
* needs GMU initialized.
|
||||
*/
|
||||
status = gmu_core_probe(device);
|
||||
if (status) {
|
||||
device->pdev = NULL;
|
||||
return status;
|
||||
}
|
||||
if (status)
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* The SMMU APIs use unsigned long for virtual addresses which means
|
||||
|
|
@ -1492,10 +1488,8 @@ static int adreno_probe(struct platform_device *pdev)
|
|||
ADRENO_FEATURE(adreno_dev, ADRENO_CONTENT_PROTECTION));
|
||||
|
||||
status = kgsl_device_platform_probe(device);
|
||||
if (status) {
|
||||
device->pdev = NULL;
|
||||
return status;
|
||||
}
|
||||
if (status)
|
||||
goto err;
|
||||
|
||||
/* Probe for the optional CX_DBGC block */
|
||||
adreno_cx_dbgc_probe(device);
|
||||
|
|
@ -1521,8 +1515,7 @@ static int adreno_probe(struct platform_device *pdev)
|
|||
status = PTR_ERR_OR_ZERO(device->memstore);
|
||||
if (status) {
|
||||
kgsl_device_platform_remove(device);
|
||||
device->pdev = NULL;
|
||||
return status;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Initialize the snapshot engine */
|
||||
|
|
@ -1580,6 +1573,13 @@ static int adreno_probe(struct platform_device *pdev)
|
|||
#endif
|
||||
|
||||
return 0;
|
||||
err:
|
||||
device->pdev = NULL;
|
||||
|
||||
gmu_core_remove(device);
|
||||
kgsl_bus_close(device);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void _adreno_free_memories(struct adreno_device *adreno_dev)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ u32 *kgsl_bus_get_table(struct platform_device *pdev,
|
|||
if (num <= 0)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
levels = kcalloc(num, sizeof(*levels), GFP_KERNEL);
|
||||
levels = devm_kcalloc(&pdev->dev, num, sizeof(*levels), GFP_KERNEL);
|
||||
if (!levels)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
|
@ -172,10 +172,5 @@ done:
|
|||
|
||||
void kgsl_bus_close(struct kgsl_device *device)
|
||||
{
|
||||
struct kgsl_pwrctrl *pwr = &device->pwrctrl;
|
||||
|
||||
kfree(pwr->ddr_table);
|
||||
|
||||
/* FIXME: Make sure icc put can handle NULL or IS_ERR */
|
||||
icc_put(pwr->icc_path);
|
||||
icc_put(device->pwrctrl.icc_path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -945,7 +945,7 @@ static int gmu_bus_vote_init(struct kgsl_device *device)
|
|||
if (count > 0)
|
||||
cnoc = build_rpmh_bw_votes(a660_cnoc_bcms,
|
||||
ARRAY_SIZE(a660_cnoc_bcms), cnoc_table, count);
|
||||
kfree(cnoc_table);
|
||||
devm_kfree(&device->pdev->dev, cnoc_table);
|
||||
|
||||
if (IS_ERR(cnoc)) {
|
||||
free_rpmh_bw_votes(ddr);
|
||||
|
|
@ -1746,8 +1746,8 @@ static void gmu_remove(struct kgsl_device *device)
|
|||
gmu->cx_gdsc = NULL;
|
||||
}
|
||||
|
||||
device->gmu_core.flags = 0;
|
||||
device->gmu_core.ptr = NULL;
|
||||
memset(&device->gmu_core, 0, sizeof(device->gmu_core));
|
||||
|
||||
gmu->pdev = NULL;
|
||||
kfree(gmu);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -447,9 +447,16 @@ static bool rgmu_regulator_isenabled(struct kgsl_device *device)
|
|||
return (rgmu->gx_gdsc && regulator_is_enabled(rgmu->gx_gdsc));
|
||||
}
|
||||
|
||||
static void rgmu_remove(struct kgsl_device *device)
|
||||
{
|
||||
rgmu_stop(device);
|
||||
|
||||
memset(&device->gmu_core, 0, sizeof(device->gmu_core));
|
||||
}
|
||||
|
||||
struct gmu_core_ops rgmu_ops = {
|
||||
.probe = rgmu_probe,
|
||||
.remove = rgmu_stop,
|
||||
.remove = rgmu_remove,
|
||||
.init = rgmu_init,
|
||||
.start = rgmu_start,
|
||||
.stop = rgmu_stop,
|
||||
|
|
|
|||
Loading…
Reference in a new issue