All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
	Keerthy <j-keerthy@ti.com>, Tero Kristo <t-kristo@ti.com>,
	Dave Gerlach <d-gerlach@ti.com>,
	linux-omap@vger.kernel.org
Subject: [PATCH 7/9] regulator: tps65218-regulator: Remove pointless 'is unsigned int <0' check
Date: Fri, 26 Jun 2020 07:57:36 +0100	[thread overview]
Message-ID: <20200626065738.93412-8-lee.jones@linaro.org> (raw)
In-Reply-To: <20200626065738.93412-1-lee.jones@linaro.org>

'rid' is declared as unsigned int, so there is little point checking for <0.

Removing these checks fixes the following W=1 warnings:

 drivers/regulator/tps65218-regulator.c: In function ‘tps65218_pmic_set_suspend_enable’:
 drivers/regulator/tps65218-regulator.c:131:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 131 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
 | ^
 drivers/regulator/tps65218-regulator.c: In function ‘tps65218_pmic_set_suspend_disable’:
 drivers/regulator/tps65218-regulator.c:144:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 144 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
 | ^

Cc: Keerthy <j-keerthy@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/regulator/tps65218-regulator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index 05d13f8079182..9133d0af793a7 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -128,7 +128,7 @@ static int tps65218_pmic_set_suspend_enable(struct regulator_dev *dev)
 	struct tps65218 *tps = rdev_get_drvdata(dev);
 	unsigned int rid = rdev_get_id(dev);
 
-	if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
+	if (rid > TPS65218_LDO_1)
 		return -EINVAL;
 
 	return tps65218_clear_bits(tps, dev->desc->bypass_reg,
@@ -141,7 +141,7 @@ static int tps65218_pmic_set_suspend_disable(struct regulator_dev *dev)
 	struct tps65218 *tps = rdev_get_drvdata(dev);
 	unsigned int rid = rdev_get_id(dev);
 
-	if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
+	if (rid > TPS65218_LDO_1)
 		return -EINVAL;
 
 	/*
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: Dave Gerlach <d-gerlach@ti.com>, Keerthy <j-keerthy@ti.com>,
	linux-kernel@vger.kernel.org, Tero Kristo <t-kristo@ti.com>,
	linux-omap@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/9] regulator: tps65218-regulator: Remove pointless 'is unsigned int <0' check
Date: Fri, 26 Jun 2020 07:57:36 +0100	[thread overview]
Message-ID: <20200626065738.93412-8-lee.jones@linaro.org> (raw)
In-Reply-To: <20200626065738.93412-1-lee.jones@linaro.org>

'rid' is declared as unsigned int, so there is little point checking for <0.

Removing these checks fixes the following W=1 warnings:

 drivers/regulator/tps65218-regulator.c: In function ‘tps65218_pmic_set_suspend_enable’:
 drivers/regulator/tps65218-regulator.c:131:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 131 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
 | ^
 drivers/regulator/tps65218-regulator.c: In function ‘tps65218_pmic_set_suspend_disable’:
 drivers/regulator/tps65218-regulator.c:144:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 144 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
 | ^

Cc: Keerthy <j-keerthy@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/regulator/tps65218-regulator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index 05d13f8079182..9133d0af793a7 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -128,7 +128,7 @@ static int tps65218_pmic_set_suspend_enable(struct regulator_dev *dev)
 	struct tps65218 *tps = rdev_get_drvdata(dev);
 	unsigned int rid = rdev_get_id(dev);
 
-	if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
+	if (rid > TPS65218_LDO_1)
 		return -EINVAL;
 
 	return tps65218_clear_bits(tps, dev->desc->bypass_reg,
@@ -141,7 +141,7 @@ static int tps65218_pmic_set_suspend_disable(struct regulator_dev *dev)
 	struct tps65218 *tps = rdev_get_drvdata(dev);
 	unsigned int rid = rdev_get_id(dev);
 
-	if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
+	if (rid > TPS65218_LDO_1)
 		return -EINVAL;
 
 	/*
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-06-26  6:58 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-26  6:57 [PATCH 0/9] Fix a bunch more W=1 warnings in Regulator Lee Jones
2020-06-26  6:57 ` Lee Jones
2020-06-26  6:57 ` [PATCH 1/9] regulator: max8998: Staticify internal function max8998_get_current_limit() Lee Jones
2020-06-26  6:57   ` Lee Jones
2020-06-26  6:57 ` [PATCH 2/9] regulator: qcom-rpmh-regulator: Repair dodgy kerneldoc header formatting Lee Jones
2020-06-26  6:57   ` Lee Jones
2020-06-26  7:18   ` Bjorn Andersson
2020-06-26  7:18     ` Bjorn Andersson
2020-06-26  6:57 ` [PATCH 3/9] regulator: pwm-regulator: Demote kerneldoc header to standard comment Lee Jones
2020-06-26  6:57   ` Lee Jones
2020-06-26  6:57 ` [PATCH 4/9] regulator: stpmic1_regulator: Properly document 'struct stpmic1_regulator_cfg' Lee Jones
2020-06-26  6:57   ` Lee Jones
2020-06-26  6:57 ` [PATCH 5/9] regulator: tps65217-regulator: Remove pointless 'is unsigned int <0' check Lee Jones
2020-06-26  6:57   ` Lee Jones
2020-06-26  6:57 ` [PATCH 6/9] regulator: tps65217-regulator: Use the returned value of tps65217_reg_read() Lee Jones
2020-06-26  6:57   ` Lee Jones
2020-06-26 13:33   ` Mark Brown
2020-06-26 13:33     ` Mark Brown
2020-06-26 15:31     ` Lee Jones
2020-06-26 15:31       ` Lee Jones
2020-06-26 15:34       ` Mark Brown
2020-06-26 15:34         ` Mark Brown
2020-06-26  6:57 ` Lee Jones [this message]
2020-06-26  6:57   ` [PATCH 7/9] regulator: tps65218-regulator: Remove pointless 'is unsigned int <0' check Lee Jones
2020-06-26  6:57 ` [PATCH 8/9] regulator: wm8400-regulator: Repair dodgy kerneldoc header formatting Lee Jones
2020-06-26  6:57   ` Lee Jones
2020-06-26  9:20   ` Charles Keepax
2020-06-26  9:20     ` Charles Keepax
2020-06-26  6:57 ` [PATCH 9/9] regulator: qcom_smd-regulator: Remove unused 'struct regulator_desc pmi8994_boost' Lee Jones
2020-06-26  6:57   ` Lee Jones
2020-06-26  7:19   ` Bjorn Andersson
2020-06-26  7:19     ` Bjorn Andersson
2020-06-26 15:21 ` [PATCH 0/9] Fix a bunch more W=1 warnings in Regulator Mark Brown
2020-06-26 15:21   ` Mark Brown

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=20200626065738.93412-8-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=broonie@kernel.org \
    --cc=d-gerlach@ti.com \
    --cc=j-keerthy@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=t-kristo@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.