From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
"David S . Miller" <davem@davemloft.net>,
linux-can@vger.kernel.org, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] can: kvaser_pciefd: remove redundant negative check on trigger
Date: Thu, 25 Jul 2019 14:37:08 +0200 [thread overview]
Message-ID: <5D39A274.1000800@bfs.de> (raw)
In-Reply-To: <20190725112509.1075-1-colin.king@canonical.com>
Am 25.07.2019 13:25, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> The check to see if trigger is less than zero is always false, trigger
> is always in the range 0..255. Hence the check is redundant and can
> be removed.
>
> Addresses-Coverity: ("Logically dead code")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/net/can/kvaser_pciefd.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c
> index 3af747cbbde4..68e00aad0810 100644
> --- a/drivers/net/can/kvaser_pciefd.c
> +++ b/drivers/net/can/kvaser_pciefd.c
> @@ -652,9 +652,6 @@ static void kvaser_pciefd_pwm_stop(struct kvaser_pciefd_can *can)
> top = (pwm_ctrl >> KVASER_PCIEFD_KCAN_PWM_TOP_SHIFT) & 0xff;
>
> trigger = (100 * top + 50) / 100;
> - if (trigger < 0)
> - trigger = 0;
> -
to be fair i do not understand the calculation here here.
(100*top+50)/100 = top+50/100
but seems to be int so it should be =top
did i missunderstand something here ?
re,
wh
> pwm_ctrl = trigger & 0xff;
> pwm_ctrl |= (top & 0xff) << KVASER_PCIEFD_KCAN_PWM_TOP_SHIFT;
> iowrite32(pwm_ctrl, can->reg_base + KVASER_PCIEFD_KCAN_PWM_REG);
next prev parent reply other threads:[~2019-07-25 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 11:25 [PATCH][next] can: kvaser_pciefd: remove redundant negative check on trigger Colin King
2019-07-25 12:37 ` walter harms [this message]
2019-07-25 12:41 ` Colin Ian King
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=5D39A274.1000800@bfs.de \
--to=wharms@bfs.de \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=wg@grandegger.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;
as well as URLs for NNTP newsgroup(s).