linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaomeng Tong <xiam0nd.tong@gmail.com>
To: patrik.r.jakobsson@gmail.com
Cc: airlied@linux.ie, airlied@redhat.com, daniel@ffwll.ch,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	xiam0nd.tong@gmail.com, yakui.zhao@intel.com
Subject: Re: [PATCH 5/5] gma500: fix a missing break in psb_driver_load
Date: Fri,  1 Apr 2022 19:16:04 +0800	[thread overview]
Message-ID: <20220401111604.8106-1-xiam0nd.tong@gmail.com> (raw)
In-Reply-To: <CAMeQTsYcyk9vRO6OaBi-KsptBzJ1Jh-2bOa0UW1+F+JUnDwH=g@mail.gmail.com>

On Fri, 1 Apr 2022 12:10:48 +0200, Patrik Jakobsson wrote:
> On Wed, Mar 30, 2022 at 2:03 PM Xiaomeng Tong <xiam0nd.tong@gmail.com> wrote:
> >
> > Instead of exiting the loop as expected when an entry is found, the
> > list_for_each_entry() continues until the traversal is complete. To
> > avoid potential executing 'ret = gma_backlight_init(dev);' repeatly,
> > add a break after the switch statement.
> >
> > Fixes: 5c49fd3aa0ab0 ("gma500: Add the core DRM files and headers")
> > Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
> 
> This is incorrect. If we always break on the first iteration we will
> only run gma_backlight_init() if the first connector is LVDS or MIPI.
> This might not be the case and gma_backlight_init() will never run.
> The other loops you have been looking at have an "if (xxx != yyy)
> continue;" statement at the top which skips all the unwanted entries
> but this loop does not.
> 

Yes, your are correct. But it still need to break the loop when found it.
So it is better to add if(!ret) break; after the switch statment.
I will resend another patch if it is necessary.

> > ---
> >  drivers/gpu/drm/gma500/psb_drv.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
> > index 65cf1c79dd7c..d65a68811bf7 100644
> > --- a/drivers/gpu/drm/gma500/psb_drv.c
> > +++ b/drivers/gpu/drm/gma500/psb_drv.c
> > @@ -398,6 +398,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
> >                         ret = gma_backlight_init(dev);
> >                         break;
> >                 }
> > +
> > +               break;
> >         }
> >
> >         if (ret)
> > --
> > 2.17.1
> >

--
Xiaomeng Tong

      reply	other threads:[~2022-04-01 11:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 12:02 [PATCH 0/5] fix missing break in list_or_each_entry Xiaomeng Tong
2022-03-30 12:02 ` [PATCH 1/5] gma500: fix a missing break in oaktrail_crtc_mode_set Xiaomeng Tong
2022-04-01  9:25   ` Patrik Jakobsson
2022-03-30 12:02 ` [PATCH 2/5] gma500: fix a missing break in cdv_intel_crtc_mode_set Xiaomeng Tong
2022-04-01  9:28   ` Patrik Jakobsson
2022-03-30 12:02 ` [PATCH 3/5] gma500: fix a missing break in psb_intel_crtc_mode_set Xiaomeng Tong
2022-04-01  9:53   ` Patrik Jakobsson
2022-04-01 11:07     ` Xiaomeng Tong
2022-03-30 12:02 ` [PATCH 4/5] gma500: fix a missing break in cdv_intel_dp_set_m_n Xiaomeng Tong
2022-04-01 10:03   ` Patrik Jakobsson
2022-03-30 12:02 ` [PATCH 5/5] gma500: fix a missing break in psb_driver_load Xiaomeng Tong
2022-04-01 10:10   ` Patrik Jakobsson
2022-04-01 11:16     ` Xiaomeng Tong [this message]

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=20220401111604.8106-1-xiam0nd.tong@gmail.com \
    --to=xiam0nd.tong@gmail.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrik.r.jakobsson@gmail.com \
    --cc=yakui.zhao@intel.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).