Skip to contentSkip to conversation

coresight: etm4x: Fix width of CCITMIN field

PATCH Applied James Clark 2 participants 2 messages Nov 1, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 coresight: etm4x: Fix width of CCITMIN field

CCITMIN is a 12 bit field and doesn't fit in a u8, so extend it to u16. This probably wasn't an issue previously because values higher than 255 never occurred.

But since commit 0f55b43dedcd ("coresight: etm: Override TRCIDR3.CCITMIN on errata affected cpus"), a comparison with 256 was done to enable the errata, generating the following W=1 build error:

coresight-etm4x-core.c:1188:24: error: result of comparison of constant 256 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]

if (drvdata->ccitmin == 256)

Fixes 2e1cdfe184b5 ("coresight-etm4x: Adding CoreSight ETM4x driver")

---

Changes since V1:
* Change the fixes commit to the original addition of ccitmin, rather than the last refactor of the struct.

 drivers/hwtracing/coresight/coresight-etm4x.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-etm4x.h +1 -1
index 20e2e4cb7614..da17b6c49b0f 100644
@@ -1036,7 +1036,7 @@ struct etmv4_drvdata {
 	u8				ctxid_size;
 	u8				vmid_size;
 	u8				ccsize;
-	u8				ccitmin;
+	u16				ccitmin;
 	u8				s_ex_level;
 	u8				ns_ex_level;
 	u8				q_support;
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 12 lines · James Clark

CCITMIN is a 12 bit field and doesn't fit in a u8, so extend it to u16. This probably wasn't an issue previously because values higher than 255 never occurred.

But since commit 0f55b43dedcd ("coresight: etm: Override TRCIDR3.CCITMIN on errata affected cpus"), a comparison with 256 was done to enable the errata, generating the following W=1 build error:

coresight-etm4x-core.c:1188:24: error: result of comparison of constant 256 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]

Quoted 6 lines
    if (drvdata->ccitmin == 256)
Fixes 2e1cdfe184b5 ("coresight-etm4x: Adding CoreSight ETM4x driver")

Thanks, applied to coresight next :

Suzuki