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

From: Colin Ian King
Date: Tue Oct 22 2019 - 07:57:14 EST


Hi,

Static analysis on linux-next has found a potential issue in commit:

commit 95ededc17e4e55a5fbb106f63cea06defc963a37
Author: AngeloGioacchino Del Regno <kholk11@xxxxxxxxx>
Date: Sat Oct 5 12:41:31 2019 +0200

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


Namely in drivers/thermal/qcom/tsens-v1.c, function calibrate_8976().
The analysis is as follows:

switch (mode) {
case TWO_PT_CALIB:

CID 90463 (#1 of 1): 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.

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

This seems to indicate that the shift and/or mask is not correct as the
result will always be zero.

Colin