[PATCH 1/1] coresight: trbe: Fix return value check in arm_trbe_register_coresight_cpu()

Zhen Lei thunder.leizhen at huawei.com
Fri Oct 18 07:08:58 PDT 2024


Function devm_kzalloc() returns NULL instead of ERR_PTR() when it fails.
The IS_ERR() test in the return value check should be replaced with NULL
test.

Fixes: 39744738a67d ("coresight: trbe: Allocate platform data per device")
Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
Signed-off-by: Zhen Lei <thunder.leizhen at huawei.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 96a32b213669940..93fe9860acf16bd 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -1266,7 +1266,7 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp
 	 * 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;
-- 
2.34.1




More information about the linux-arm-kernel mailing list