The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc
@ 2025-09-08 12:20 Lin Yujun
  2025-09-08 12:38 ` James Clark
  2025-09-10 16:26 ` Suzuki K Poulose
  0 siblings, 2 replies; 3+ messages in thread
From: Lin Yujun @ 2025-09-08 12:20 UTC (permalink / raw)
  To: suzuki.poulose, mike.leach, james.clark, alexander.shishkin,
	anshuman.khandual
  Cc: linux-kernel

The return value of devm_kzalloc could be an null pointer,
use "!desc.pdata" to fix incorrect handling return value
of devm_kzalloc.

Fixes: 4277f035d227 ("coresight: trbe: Add a representative coresight_platform_data for TRBE")
Signed-off-by: Lin Yujun <linyujun809@h-partners.com>
---
 drivers/hwtracing/coresight/coresight-trbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index 8267dd1a2130..caf873adfc3a 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -1277,11 +1277,11 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp
 	 * ends up failing. Instead let's allocate a dummy zeroed
 	 * coresight_platform_data structure and assign that back
 	 * into the device for that purpose.
 	 */
 	desc.pdata = devm_kzalloc(dev, sizeof(*desc.pdata), GFP_KERNEL);
-	if (IS_ERR(desc.pdata))
+	if (!desc.pdata)
 		goto cpu_clear;
 
 	desc.type = CORESIGHT_DEV_TYPE_SINK;
 	desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM;
 	desc.ops = &arm_trbe_cs_ops;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-10 16:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08 12:20 [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc Lin Yujun
2025-09-08 12:38 ` James Clark
2025-09-10 16:26 ` Suzuki K Poulose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox