]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
coresight: tpda: fix the logic to setup the element size
authorJie Gan <jie.gan@oss.qualcomm.com>
Fri, 5 Sep 2025 23:53:04 +0000 (07:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 10:00:16 +0000 (12:00 +0200)
[ Upstream commit 43e0a92c04de7c822f6104abc73caa4a857b4a02 ]

Some TPDM devices support both CMB and DSB datasets, requiring
the system to enable the port with both corresponding element sizes.

Currently, the logic treats tpdm_read_element_size as successful if
the CMB element size is retrieved correctly, regardless of whether
the DSB element size is obtained. This behavior causes issues
when parsing data from TPDM devices that depend on both element sizes.

To address this, the function should explicitly fail if the DSB
element size cannot be read correctly.

Fixes: e6d7f5252f73 ("coresight-tpda: Add support to configure CMB element")
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250906-fix_element_size_issue-v2-1-dbb0ac2541a9@oss.qualcomm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwtracing/coresight/coresight-tpda.c

index bfca103f9f84763836297d07c2e523c1583e9446..865fd6273e5e46084506085b27510ff80091f38a 100644 (file)
@@ -71,12 +71,15 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
        if (tpdm_has_dsb_dataset(tpdm_data)) {
                rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
                                "qcom,dsb-element-bits", &drvdata->dsb_esize);
+               if (rc)
+                       goto out;
        }
        if (tpdm_has_cmb_dataset(tpdm_data)) {
                rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
                                "qcom,cmb-element-bits", &drvdata->cmb_esize);
        }
 
+out:
        if (rc)
                dev_warn_once(&csdev->dev,
                        "Failed to read TPDM Element size: %d\n", rc);