Commit 3afd0634 authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Greg Kroah-Hartman

coresight: Consolidate error handling path for tmc_probe

This patch cleans up the error handling path for tmc_probe
as a side effect of the removal of the spurious dma_free_coherent().

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 481e46fe
...@@ -309,22 +309,31 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -309,22 +309,31 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
if (np) { if (np) {
pdata = of_get_coresight_platform_data(dev, np); pdata = of_get_coresight_platform_data(dev, np);
if (IS_ERR(pdata)) if (IS_ERR(pdata)) {
return PTR_ERR(pdata); ret = PTR_ERR(pdata);
goto out;
}
adev->dev.platform_data = pdata; adev->dev.platform_data = pdata;
} }
ret = -ENOMEM;
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata) if (!drvdata)
return -ENOMEM; goto out;
desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
if (!desc)
goto out;
drvdata->dev = &adev->dev; drvdata->dev = &adev->dev;
dev_set_drvdata(dev, drvdata); dev_set_drvdata(dev, drvdata);
/* Validity for the resource is already checked by the AMBA core */ /* Validity for the resource is already checked by the AMBA core */
base = devm_ioremap_resource(dev, res); base = devm_ioremap_resource(dev, res);
if (IS_ERR(base)) if (IS_ERR(base)) {
return PTR_ERR(base); ret = PTR_ERR(base);
goto out;
}
drvdata->base = base; drvdata->base = base;
...@@ -347,12 +356,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -347,12 +356,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
pm_runtime_put(&adev->dev); pm_runtime_put(&adev->dev);
desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
if (!desc) {
ret = -ENOMEM;
goto err_devm_kzalloc;
}
desc->pdata = pdata; desc->pdata = pdata;
desc->dev = dev; desc->dev = dev;
desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;
...@@ -373,7 +376,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -373,7 +376,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
drvdata->csdev = coresight_register(desc); drvdata->csdev = coresight_register(desc);
if (IS_ERR(drvdata->csdev)) { if (IS_ERR(drvdata->csdev)) {
ret = PTR_ERR(drvdata->csdev); ret = PTR_ERR(drvdata->csdev);
goto err_devm_kzalloc; goto out;
} }
drvdata->miscdev.name = pdata->name; drvdata->miscdev.name = pdata->name;
...@@ -381,13 +384,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -381,13 +384,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
drvdata->miscdev.fops = &tmc_fops; drvdata->miscdev.fops = &tmc_fops;
ret = misc_register(&drvdata->miscdev); ret = misc_register(&drvdata->miscdev);
if (ret) if (ret)
goto err_misc_register;
return 0;
err_misc_register:
coresight_unregister(drvdata->csdev); coresight_unregister(drvdata->csdev);
err_devm_kzalloc: out:
return ret; return ret;
} }
......
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