# qcom: tsens-v1: MSM8976 base1 setting

- From: Colin Ian King \<hidden\>
- Date: 2021-02-26 19:33:30 
- List: linux-pm
- Page: https://ratatoskr.run/linux-pm/2021/02/8285599
- Thread: https://ratatoskr.run/linux-arm-msm/2021/02/8285599/t.md

```text
Hi there,

Static analysis with Coverity has found a potential issue in the
following commit:

commit 0e580290170dfb438d911c306b27d89d5b99c1d9
Author: AngeloGioacchino Del Regno [ref]
Date:   Sat Oct 5 12:41:31 2019 +0200

    thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976

The analysis is as follows on function calibrate_8976 in
drivers/thermal/qcom/tsens-v1.c:

249        switch (mode) {
250        case TWO_PT_CALIB:

Operands don't affect result (CONSTANT_EXPRESSION_RESULT)

result_independent_of_operands: (qfprom_cdata[2] & 255) >> 8 is 0
regardless of the values of its operands. This occurs as the operand of
assignment.

251                base1 = (qfprom_cdata[2] & MSM8976_BASE1_MASK) >>
MSM8976_BASE1_SHIFT;

MSM8976_BASE1_MASK is 0xff, MSM8976_BASE1_SHIFT is 8, so base1 is always
going to end up as zero no matter what value in qfprom_cdata[2] is. I
don't have any data sheet for this hardware, so I'm not sure of the
exact intention, but I think MSM8976_BASE1_MASK should be 0xff00 - hence
I'm reaching out to report this issue with my understanding of the issue.

Colin
```
