diff options
author | Anshuman Khandual <anshuman.khandual@arm.com> | 2023-08-17 09:29:26 +0530 |
---|---|---|
committer | Suzuki K Poulose <suzuki.poulose@arm.com> | 2023-08-17 11:49:21 +0100 |
commit | a4621fd1d4fd04fe2d8105a4d64e85cdc4a259b1 (patch) | |
tree | b9fe3ca2a78d91e8b928392b90101f095bb005d9 /drivers/hwtracing/coresight/coresight-etm4x-core.c | |
parent | 39744738a67de9153d73e11817937c0004feab2e (diff) | |
download | linux-stable-a4621fd1d4fd04fe2d8105a4d64e85cdc4a259b1.tar.gz linux-stable-a4621fd1d4fd04fe2d8105a4d64e85cdc4a259b1.tar.bz2 linux-stable-a4621fd1d4fd04fe2d8105a4d64e85cdc4a259b1.zip |
coresight: etm4x: Ensure valid drvdata and clock before clk_put()
This validates 'drvdata' and 'drvdata->pclk' clock before calling clk_put()
in etm4_remove_platform_dev(). The problem was detected using Smatch static
checker as reported.
Fixes: 73d779a03a76a ("coresight: etm4x: Change etm4_platform_driver driver for MMIO devices")
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: James Clark <james.clark@arm.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lists.linaro.org/archives/list/coresight@lists.linaro.org/thread/G4N6P4OXELPLLQSNU3GU2MR4LOLRXRMJ/
Reviewed-by: James Clark <james.clark@arm.com>
Reviewed-by: Mike Leach <mike.leach@lnaro.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230817035926.157370-1-anshuman.khandual@arm.com
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-etm4x-core.c')
-rw-r--r-- | drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 703b6fcbb6a5..77b0271ce6eb 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2269,7 +2269,7 @@ static int __exit etm4_remove_platform_dev(struct platform_device *pdev) etm4_remove_dev(drvdata); pm_runtime_disable(&pdev->dev); - if (drvdata->pclk) + if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) clk_put(drvdata->pclk); return 0; |