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

coresight: dynamic-replicator: Clean up error handling

We fail to disable the clock in case of a failure during the
probe. Clean this up. Also, we are supposed to drop the pm reference
only when the probing is successful.

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 08be8747
...@@ -150,7 +150,7 @@ static const struct attribute_group *replicator_groups[] = { ...@@ -150,7 +150,7 @@ static const struct attribute_group *replicator_groups[] = {
static int replicator_probe(struct amba_device *adev, const struct amba_id *id) static int replicator_probe(struct amba_device *adev, const struct amba_id *id)
{ {
int ret; int ret = 0;
struct device *dev = &adev->dev; struct device *dev = &adev->dev;
struct resource *res = &adev->res; struct resource *res = &adev->res;
struct coresight_platform_data *pdata = NULL; struct coresight_platform_data *pdata = NULL;
...@@ -180,12 +180,13 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -180,12 +180,13 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id)
/* 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_disable_clk;
}
drvdata->base = base; drvdata->base = base;
dev_set_drvdata(dev, drvdata); dev_set_drvdata(dev, drvdata);
pm_runtime_put(&adev->dev);
desc.type = CORESIGHT_DEV_TYPE_LINK; desc.type = CORESIGHT_DEV_TYPE_LINK;
desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT;
...@@ -195,11 +196,18 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -195,11 +196,18 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id)
desc.groups = replicator_groups; desc.groups = replicator_groups;
drvdata->csdev = coresight_register(&desc); drvdata->csdev = coresight_register(&desc);
if (!IS_ERR(drvdata->csdev)) { if (IS_ERR(drvdata->csdev)) {
replicator_reset(drvdata); ret = PTR_ERR(drvdata->csdev);
return 0; goto out_disable_clk;
} }
return PTR_ERR(drvdata->csdev);
replicator_reset(drvdata);
pm_runtime_put(&adev->dev);
out_disable_clk:
if (ret && !IS_ERR_OR_NULL(drvdata->atclk))
clk_disable_unprepare(drvdata->atclk);
return ret;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
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