linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kholk11@gmail.com
Cc: linux-pm@vger.kernel.org
Subject: [bug report] thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976
Date: Wed, 23 Oct 2019 16:11:19 +0300	[thread overview]
Message-ID: <20191023131119.GA3987@mwanda> (raw)

Hello AngeloGioacchino Del Regno,

The patch 95ededc17e4e: "thermal: qcom: tsens-v1: Add support for
MSM8956 and MSM8976" from Oct 5, 2019, leads to the following static
checker warning:

	drivers/thermal/qcom/tsens-v1.c:253 calibrate_8976()
	warn: mask and shift to zero

drivers/thermal/qcom/tsens-v1.c
   235  static int calibrate_8976(struct tsens_priv *priv)
   236  {
   237          int base0 = 0, base1 = 0, i;
   238          u32 p1[11], p2[11];
   239          int mode = 0, tmp = 0;
   240          u32 *qfprom_cdata;
   241  
   242          qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
   243          if (IS_ERR(qfprom_cdata)) {
   244                  kfree(qfprom_cdata);
   245                  return PTR_ERR(qfprom_cdata);
   246          }
   247  
   248          mode = (qfprom_cdata[4] & MSM8976_CAL_SEL_MASK);
   249          dev_dbg(priv->dev, "calibration mode is %d\n", mode);
   250  
   251          switch (mode) {
   252          case TWO_PT_CALIB:
   253                  base1 = (qfprom_cdata[2] & MSM8976_BASE1_MASK) >> MSM8976_BASE1_SHIFT;
                                                   ^^^^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^^^^^^
                                                   0xff                >> 8
base1 is always going to be zero.

   254                  p2[0] = (qfprom_cdata[0] & MSM8976_S0_P2_MASK) >> MSM8976_S0_P2_SHIFT;
   255                  p2[1] = (qfprom_cdata[0] & MSM8976_S1_P2_MASK) >> MSM8976_S1_P2_SHIFT;
   256                  p2[2] = (qfprom_cdata[1] & MSM8976_S2_P2_MASK) >> MSM8976_S2_P2_SHIFT;
   257                  p2[3] = (qfprom_cdata[1] & MSM8976_S3_P2_MASK) >> MSM8976_S3_P2_SHIFT;
   258                  p2[4] = (qfprom_cdata[2] & MSM8976_S4_P2_MASK) >> MSM8976_S4_P2_SHIFT;
   259                  p2[5] = (qfprom_cdata[2] & MSM8976_S5_P2_MASK) >> MSM8976_S5_P2_SHIFT;
   260                  p2[6] = (qfprom_cdata[3] & MSM8976_S6_P2_MASK) >> MSM8976_S6_P2_SHIFT;
   261                  p2[7] = (qfprom_cdata[3] & MSM8976_S7_P2_MASK) >> MSM8976_S7_P2_SHIFT;
   262                  p2[8] = (qfprom_cdata[4] & MSM8976_S8_P2_MASK) >> MSM8976_S8_P2_SHIFT;
   263                  p2[9] = (qfprom_cdata[4] & MSM8976_S9_P2_MASK) >> MSM8976_S9_P2_SHIFT;
   264                  p2[10] = (qfprom_cdata[5] & MSM8976_S10_P2_MASK) >> MSM8976_S10_P2_SHIFT;
   265  
   266                  for (i = 0; i < priv->num_sensors; i++)
   267                          p2[i] = ((base1 + p2[i]) << 2);
   268                  /* Fall through */

regards,
dan carpenter

                 reply	other threads:[~2019-10-23 13:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191023131119.GA3987@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kholk11@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).