All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de,
	linux-pwm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com
Subject: [PATCH 2/4] pwm: bcm-kona: Remove impossible comparison when validating duty cycle
Date: Mon, 29 Jun 2020 13:47:50 +0100	[thread overview]
Message-ID: <20200629124752.1018358-3-lee.jones@linaro.org> (raw)
In-Reply-To: <20200629124752.1018358-1-lee.jones@linaro.org>

'dc' here is an unsigned long, thus checking for <0 will always
evaluate to false.

Fixes the following W=1 warning:

 drivers/pwm/pwm-bcm-kona.c:141:35: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]

Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-pwm@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/pwm/pwm-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c
index 81da91df2529a..16c5898b934a8 100644
--- a/drivers/pwm/pwm-bcm-kona.c
+++ b/drivers/pwm/pwm-bcm-kona.c
@@ -138,7 +138,7 @@ static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm,
 		dc = div64_u64(val, div);
 
 		/* If duty_ns or period_ns are not achievable then return */
-		if (pc < PERIOD_COUNT_MIN || dc < DUTY_CYCLE_HIGH_MIN)
+		if (pc < PERIOD_COUNT_MIN)
 			return -EINVAL;
 
 		/* If pc and dc are in bounds, the calculation is done */
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de,
	linux-pwm@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Scott Branden <sbranden@broadcom.com>,
	Ray Jui <rjui@broadcom.com>,
	linux-kernel@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com,
	Lee Jones <lee.jones@linaro.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] pwm: bcm-kona: Remove impossible comparison when validating duty cycle
Date: Mon, 29 Jun 2020 13:47:50 +0100	[thread overview]
Message-ID: <20200629124752.1018358-3-lee.jones@linaro.org> (raw)
In-Reply-To: <20200629124752.1018358-1-lee.jones@linaro.org>

'dc' here is an unsigned long, thus checking for <0 will always
evaluate to false.

Fixes the following W=1 warning:

 drivers/pwm/pwm-bcm-kona.c:141:35: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]

Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-pwm@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/pwm/pwm-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c
index 81da91df2529a..16c5898b934a8 100644
--- a/drivers/pwm/pwm-bcm-kona.c
+++ b/drivers/pwm/pwm-bcm-kona.c
@@ -138,7 +138,7 @@ static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm,
 		dc = div64_u64(val, div);
 
 		/* If duty_ns or period_ns are not achievable then return */
-		if (pc < PERIOD_COUNT_MIN || dc < DUTY_CYCLE_HIGH_MIN)
+		if (pc < PERIOD_COUNT_MIN)
 			return -EINVAL;
 
 		/* If pc and dc are in bounds, the calculation is done */
-- 
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-29 21:45 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 12:47 [PATCH 0/4] Fix a bunch of W=1 warnings in PWM Lee Jones
2020-06-29 12:47 ` Lee Jones
2020-06-29 12:47 ` [PATCH 1/4] pwm: bcm-iproc: Remove impossible comparison when validating duty cycle Lee Jones
2020-06-29 12:47   ` Lee Jones
2020-06-29 12:47   ` Lee Jones
2020-06-29 16:45   ` Florian Fainelli
2020-06-29 16:45     ` Florian Fainelli
2020-06-29 16:45     ` Florian Fainelli
2020-06-29 16:54     ` Scott Branden
2020-06-29 16:54       ` Scott Branden
2020-06-29 16:54       ` Scott Branden
2020-06-29 19:45   ` Uwe Kleine-König
2020-06-29 19:45     ` Uwe Kleine-König
2020-06-29 19:45     ` Uwe Kleine-König
2020-06-29 12:47 ` Lee Jones [this message]
2020-06-29 12:47   ` [PATCH 2/4] pwm: bcm-kona: " Lee Jones
2020-06-29 16:45   ` Florian Fainelli
2020-06-29 16:45     ` Florian Fainelli
2020-06-29 19:41     ` Uwe Kleine-König
2020-06-29 19:41       ` Uwe Kleine-König
2020-06-29 12:47 ` [PATCH 3/4] pwm: mediatek: Provide missing kerneldoc description for 'soc' arg Lee Jones
2020-06-29 12:47   ` Lee Jones
2020-06-29 12:47   ` Lee Jones
2020-06-29 19:47   ` Uwe Kleine-König
2020-06-29 19:47     ` Uwe Kleine-König
2020-06-29 19:47     ` Uwe Kleine-König
2020-06-29 12:47 ` [PATCH 4/4] pwm: omap-dmtimer: Repair pwm_omap_dmtimer_chip's broken kerneldoc header Lee Jones
2020-06-29 12:47   ` Lee Jones
2020-06-29 19:39   ` Uwe Kleine-König
2020-06-29 19:39     ` Uwe Kleine-König
2020-07-27  7:50 ` [PATCH 0/4] Fix a bunch of W=1 warnings in PWM Thierry Reding
2020-07-27  7:50   ` Thierry Reding

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=20200629124752.1018358-3-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.