coresight: tmc: Cleanup power management
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Thu, 25 Apr 2019 19:52:50 +0000 (13:52 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Apr 2019 20:00:16 +0000 (22:00 +0200)
Drop the power only if we were successful in probing the device.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight-tmc.c

index 647b6aa93554a0cec0c581ae59b57a823652c59f..c6a5462ebf27d8b26492b6b7a2d7df8adb27b7c3 100644 (file)
@@ -432,8 +432,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
                drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4;
        }
 
-       pm_runtime_put(&adev->dev);
-
        desc.pdata = pdata;
        desc.dev = dev;
        desc.groups = coresight_tmc_groups;
@@ -476,6 +474,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
        ret = misc_register(&drvdata->miscdev);
        if (ret)
                coresight_unregister(drvdata->csdev);
+       else
+               pm_runtime_put(&adev->dev);
 out:
        return ret;
 }