Skip to contentSkip to conversation

drivers/thermal/qcom/tsens-v0_1.c:189 calibrate_8974() warn: passing zero to 'PTR_ERR'

PATCH In review Dan Carpenter 2 participants 2 messages Apr 24, 2019 – Apr 25, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 19/35 drivers/thermal/qcom/tsens-v0_1.c:189 calibrate_8974() warn: passing zero to 'PTR_ERR'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git for-kernelci
head:   0e50a5ee6b8a23c6798aae23efcd4b8e055c06ef
commit: 5853cb769573b58c319fa62e1987d063b8c5b77e [19/35] drivers: thermal: tsens: Merge tsens-8974 into tsens-v0_1

New smatch warnings:
drivers/thermal/qcom/tsens-v0_1.c:228 calibrate_8974() warn: mask and shift to zero

# https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git/commit/?id=5853cb769573b58c319fa62e1987d063b8c5b77e
git remote add soc-thermal https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git
git remote update soc-thermal
git checkout 5853cb769573b58c319fa62e1987d063b8c5b77e
vim +/PTR_ERR +189 drivers/thermal/qcom/tsens-v0_1.c

5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  216  			/* Fall through */
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  217  		case ONE_PT_CALIB:
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  218  		case ONE_PT_CALIB2:
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  219  			base1 = bkp[0] & BASE1_MASK;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  220  			p1[0] = (bkp[0] & S0_P1_MASK) >> S0_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  221  			p1[1] = (bkp[0] & S1_P1_MASK) >> S1_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  222  			p1[2] = (bkp[0] & S2_P1_MASK) >> S2_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  223  			p1[3] = (bkp[0] & S3_P1_MASK) >> S3_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  224  			p1[4] = (bkp[1] & S4_P1_MASK);
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  225  			p1[5] = (bkp[1] & S5_P1_MASK) >> S5_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  226  			p1[6] = (bkp[1] & S6_P1_MASK) >> S6_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  227  			p1[7] = (bkp[1] & S7_P1_MASK) >> S7_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20 @228  			p1[8] = (bkp[2] & S8_P1_MASK_BKP) >> S8_P1_SHIFT;
                                                                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

p1[8] always ends up being zero. (I haven't look at the code, that's what the static checker is saying).

5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  229  			p1[9] = (bkp[2] & S9_P1_MASK_BKP) >> S9_P1_BKP_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  230  			p1[10] = (bkp[2] & S10_P1_MASK_BKP) >> S10_P1_BKP_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  231  			break;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  232  		}
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  233  	} else {
#1 lore raw
Quoted 28 lines · Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git for-kernelci
head:   0e50a5ee6b8a23c6798aae23efcd4b8e055c06ef
commit: 5853cb769573b58c319fa62e1987d063b8c5b77e [19/35] drivers: thermal: tsens: Merge tsens-8974 into tsens-v0_1

New smatch warnings:
drivers/thermal/qcom/tsens-v0_1.c:228 calibrate_8974() warn: mask and shift to zero

# https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git/commit/?id=5853cb769573b58c319fa62e1987d063b8c5b77e
git remote add soc-thermal https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git
git remote update soc-thermal
git checkout 5853cb769573b58c319fa62e1987d063b8c5b77e
vim +/PTR_ERR +189 drivers/thermal/qcom/tsens-v0_1.c

5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  216                     /* Fall through */
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  217             case ONE_PT_CALIB:
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  218             case ONE_PT_CALIB2:
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  219                     base1 = bkp[0] & BASE1_MASK;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  220                     p1[0] = (bkp[0] & S0_P1_MASK) >> S0_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  221                     p1[1] = (bkp[0] & S1_P1_MASK) >> S1_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  222                     p1[2] = (bkp[0] & S2_P1_MASK) >> S2_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  223                     p1[3] = (bkp[0] & S3_P1_MASK) >> S3_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  224                     p1[4] = (bkp[1] & S4_P1_MASK);
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  225                     p1[5] = (bkp[1] & S5_P1_MASK) >> S5_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  226                     p1[6] = (bkp[1] & S6_P1_MASK) >> S6_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20  227                     p1[7] = (bkp[1] & S7_P1_MASK) >> S7_P1_SHIFT;
5853cb7695 drivers/thermal/qcom/tsens-v0_1.c Amit Kucheria  2019-03-20 @228                     p1[8] = (bkp[2] & S8_P1_MASK_BKP) >> S8_P1_SHIFT;
                                                                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 2 lines

p1[8] always ends up being zero. (I haven't look at the code, that's what the static checker is saying).

Yes, it seems that might be the case.

Eduardo, this commit is simply moving some old code around that I didn't write. I'd prefer not to touch it in this series but instead fix it in a separate series. The code move was done to enable a rewrite, in any case.

Regards,
Amit