diff options
author | Suzuki K Poulose <suzuki.poulose@arm.com> | 2016-08-25 15:19:05 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-31 13:05:43 +0200 |
commit | 9486295ad159fac87eb05bd683445be06a3b69f5 (patch) | |
tree | 816579242f76e6481e8900d150391a17e646a438 /drivers/hwtracing/coresight/coresight-replicator-qcom.c | |
parent | 7f73b0b9faa11446f73dba02811f928a230773c5 (diff) | |
download | talos-op-linux-9486295ad159fac87eb05bd683445be06a3b69f5.tar.gz talos-op-linux-9486295ad159fac87eb05bd683445be06a3b69f5.zip |
coresight: Use local coresight_desc instances
Each coresight device prepares a description for coresight_register()
in struct coresight_desc. Once we register the device, the description is
useless and can be freed. The coresight_desc is small enough (48bytes on
64bit)i to be allocated on the stack. Hence use an automatic variable to
avoid a needless dynamic allocation and wasting the memory(which will only
be free'd when the device is destroyed).
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Pratik Patel <pratikp@codeaurora.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>
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-replicator-qcom.c')
-rw-r--r-- | drivers/hwtracing/coresight/coresight-replicator-qcom.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/hwtracing/coresight/coresight-replicator-qcom.c b/drivers/hwtracing/coresight/coresight-replicator-qcom.c index 700f710e4bfa..0a3d15f0b009 100644 --- a/drivers/hwtracing/coresight/coresight-replicator-qcom.c +++ b/drivers/hwtracing/coresight/coresight-replicator-qcom.c @@ -102,7 +102,7 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_platform_data *pdata = NULL; struct replicator_state *drvdata; - struct coresight_desc *desc; + struct coresight_desc desc = { 0 }; struct device_node *np = adev->dev.of_node; void __iomem *base; @@ -134,16 +134,12 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) dev_set_drvdata(dev, drvdata); pm_runtime_put(&adev->dev); - desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); - if (!desc) - return -ENOMEM; - - desc->type = CORESIGHT_DEV_TYPE_LINK; - desc->subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT; - desc->ops = &replicator_cs_ops; - desc->pdata = adev->dev.platform_data; - desc->dev = &adev->dev; - drvdata->csdev = coresight_register(desc); + desc.type = CORESIGHT_DEV_TYPE_LINK; + desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT; + desc.ops = &replicator_cs_ops; + desc.pdata = adev->dev.platform_data; + desc.dev = &adev->dev; + drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) return PTR_ERR(drvdata->csdev); |