Message ID | 20230817035926.157370-1-anshuman.khandual@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [V2] coresight: etm4x: Ensure valid drvdata and clock before clk_put() | expand |
On Thu, 17 Aug 2023 09:29:26 +0530, Anshuman Khandual wrote: > 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. > > Applied, thanks! [1/1] coresight: etm4x: Ensure valid drvdata and clock before clk_put() https://git.kernel.org/coresight/c/a4621fd1d4fd Best regards,
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;