From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Ben Skeggs <bskeggs@redhat.com>,
Karol Herbst <kherbst@redhat.com>, Lyude Paul <lyude@redhat.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
ML nouveau <nouveau@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: drm/nouveau: fan:
Date: Fri, 28 Jul 2023 09:09:37 +0100 [thread overview]
Message-ID: <29e17fa4-0dc3-2542-f303-7dceb1ed16bc@gmail.com> (raw)
Hi,
static analysis with cppcheck has detected an issue in function
nvkm_fan_update() in drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c as
follows:
/* schedule next fan update, if not at target speed already */
if (target != duty) {
u16 bump_period = fan->bios.bump_period;
u16 slow_down_period = fan->bios.slow_down_period;
u64 delay;
if (duty > target)
delay = slow_down_period;
else if (duty == target)
delay = min(bump_period, slow_down_period) ;
else
delay = bump_period;
nvkm_timer_alarm(tmr, delay * 1000 * 1000, &fan->alarm);
}
Checking drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.c ...
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c:93:17: warning: Opposite
inner 'if' condition leads to a dead code block. [oppositeInnerCondition]
else if (duty == target)
^
The first if statement checks if target != duty, however inside the code
block there is a check if duty == target which can never be true. Either
the logic is wrong, or the duty == target can be safely removed.
Colin
reply other threads:[~2023-07-28 8:09 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=29e17fa4-0dc3-2542-f303-7dceb1ed16bc@gmail.com \
--to=colin.i.king@gmail.com \
--cc=airlied@gmail.com \
--cc=bskeggs@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.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
all inboxes | Powered by JetHome®