From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/gma500/oaktrail_lvds: replace continue with break
Date: Sat, 19 Jun 2021 16:40:25 +0300 [thread overview]
Message-ID: <20210619134025.GH1861@kadam> (raw)
In-Reply-To: <20210618183524.590186-1-colin.king@canonical.com>
On Fri, Jun 18, 2021 at 07:35:24PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently a loop scans through the connector list checking
> for connectors that do not match a specific criteria. The
> use of the continue statement is a little unintuitive and
> can confuse static analysis checking. Invert the criteria
> matching logic and use a break to terminate the loop once
> the first suitable connector has been found.
>
> Thanks to Patrik Jakobsson for explaining the original
> intent of the code and suggesting this change.
>
> Addresses-Coverity: ("Continue has no effect")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/gpu/drm/gma500/oaktrail_lvds.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
> index 432bdcc57ac9..8541dcf237eb 100644
> --- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
> +++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
> @@ -113,8 +113,8 @@ static void oaktrail_lvds_mode_set(struct drm_encoder *encoder,
>
> /* Find the connector we're trying to set up */
> list_for_each_entry(connector, &mode_config->connector_list, head) {
> - if (!connector->encoder || connector->encoder->crtc != crtc)
> - continue;
> + if (connector->encoder && connector->encoder->crtc == crtc)
> + break;
> }
>
> if (!connector) {
This test is wrong/impossible. It should be:
if (list_entry_is_head(connector, &mode_config->connector_list,
head)) {
regards,
dan carpenter
next prev parent reply other threads:[~2021-06-19 13:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 18:35 [PATCH] drm/gma500/oaktrail_lvds: replace continue with break Colin King
2021-06-18 19:20 ` Patrik Jakobsson
2021-06-19 13:40 ` Dan Carpenter [this message]
2021-06-19 20:43 ` Patrik Jakobsson
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=20210619134025.GH1861@kadam \
--to=dan.carpenter@oracle.com \
--cc=airlied@linux.ie \
--cc=colin.king@canonical.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patrik.r.jakobsson@gmail.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