]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
coresight: Fix incorrect handling for return value of devm_kzalloc
authorLin Yujun <linyujun809@h-partners.com>
Mon, 8 Sep 2025 12:20:22 +0000 (20:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 10:00:16 +0000 (12:00 +0200)
[ Upstream commit 70714eb7243eaf333d23501d4c7bdd9daf011c01 ]

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>
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250908122022.1315399-1-linyujun809@h-partners.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwtracing/coresight/coresight-trbe.c

index 5755674913723186789585349c88788caa3733c3..d771980a278dcb73bdf3ef1e560f614ba4f40090 100644 (file)
@@ -1267,7 +1267,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;