mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Caesar Wang <wxt@rock-chips.com>
To: Eduardo Valentin <edubezval@gmail.com>
Cc: linux-rockchip@lists.infradead.org,
	Heiko Stuebner <heiko@sntech.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Caesar Wang <wxt@rock-chips.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zhang Rui <rui.zhang@intel.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/5] thermal: rockchip: fix a impossible condition caused by the warning
Date: Mon, 30 Nov 2015 10:28:05 +0800	[thread overview]
Message-ID: <1448850488-16325-3-git-send-email-wxt@rock-chips.com> (raw)
In-Reply-To: <1448850488-16325-1-git-send-email-wxt@rock-chips.com>

As the Dan report the smatch check the thermal driver warning:
drivers/thermal/rockchip_thermal.c:551 rockchip_configure_from_dt()
warn: impossible condition '(thermal->tshut_temp > ((~0 >> 1))) =>
(s32min-s32max > s32max)'

Since the Temperature is currently represented as int not long in
the thermal driver.

Fixes: commit 437df2172e8d
("thermal: rockchip: consistently use int for temperatures")

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>

---

Changes in v2: None
Changes in v1: None

 drivers/thermal/rockchip_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index ae796ec..6b0f00d 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -549,7 +549,7 @@ static int rockchip_configure_from_dt(struct device *dev,
 		thermal->tshut_temp = shut_temp;
 	}
 
-	if (thermal->tshut_temp > INT_MAX) {
+	if (!(thermal->tshut_temp < INT_MAX)) {
 		dev_err(dev, "Invalid tshut temperature specified: %d\n",
 			thermal->tshut_temp);
 		return -ERANGE;
-- 
1.9.1


  parent reply	other threads:[~2015-11-30  2:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30  2:28 [PATCH v2 0/5] Fix a trivial typo and support rk3228/rk3399 SoCs for thermal driver Caesar Wang
2015-11-30  2:28 ` [PATCH v2 1/5] thermal: rockchip: fix a trivial typo Caesar Wang
2015-11-30  2:28 ` Caesar Wang [this message]
2015-11-30  2:28 ` [PATCH v2 3/5] dt-bindings: rockchip-thermal: Support the RK3228/RK3399 SoCs compatible Caesar Wang
2015-11-30  2:28 ` [PATCH v2 4/5] thermal: rockchip: Support the RK3228 SoCs in thermal driver Caesar Wang
2015-11-30  2:28 ` [PATCH v2 5/5] thermal: rockchip: Support the RK3399 " Caesar Wang

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=1448850488-16325-3-git-send-email-wxt@rock-chips.com \
    --to=wxt@rock-chips.com \
    --cc=dan.carpenter@oracle.com \
    --cc=edubezval@gmail.com \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=rui.zhang@intel.com \
    /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

all inboxes | Powered by JetHome®