diff mbox series

[3/5] gma500: fix a missing break in psb_intel_crtc_mode_set

Message ID 20220330120246.25580-4-xiam0nd.tong@gmail.com (mailing list archive)
State New, archived
Headers show
Series fix missing break in list_or_each_entry | expand

Commit Message

Xiaomeng Tong March 30, 2022, 12:02 p.m. UTC
Instead of exiting the loop as expected when an entry is found, the
list_for_each_entry() continues until the traversal is complete. It
could result in multiple 'is_*' flags being set with true mistakely.

To fix this, when found the entry, add a break after the switch
statement.

Fixes: 89c78134cc54d (" gma500: Add Poulsbo support")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
---
 drivers/gpu/drm/gma500/psb_intel_display.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Patrik Jakobsson April 1, 2022, 9:53 a.m. UTC | #1
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. It
> could result in multiple 'is_*' flags being set with true mistakely.
>
> To fix this, when found the entry, add a break after the switch
> statement.
>
> Fixes: 89c78134cc54d (" gma500: Add Poulsbo support")
> Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>

This patch doesn't apply for me and needs to be rebased on top of
drm-misc-next or drm-tip.

On Poulsbo there should only be one encoder per crtc so this is only a
theoretical issue. But it is good practice to exit the loop early if
we can so the patch still makes sense.

Also, please use the correct subject prefix: drm/gma500: instead of
just gma500:.

Thanks
Patrik

> ---
>  drivers/gpu/drm/gma500/psb_intel_display.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
> index 42d1a733e124..85fc61bf333a 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_display.c
> +++ b/drivers/gpu/drm/gma500/psb_intel_display.c
> @@ -134,6 +134,8 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
>                         is_tv = true;
>                         break;
>                 }
> +
> +               break;
>         }
>
>         refclk = 96000;
> --
> 2.17.1
>
Xiaomeng Tong April 1, 2022, 11:07 a.m. UTC | #2
> 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. It
> > could result in multiple 'is_*' flags being set with true mistakely.
> >
> > To fix this, when found the entry, add a break after the switch
> > statement.
> >
> > Fixes: 89c78134cc54d (" gma500: Add Poulsbo support")
> > Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
> 
> This patch doesn't apply for me and needs to be rebased on top of
> drm-misc-next or drm-tip.
> 
> On Poulsbo there should only be one encoder per crtc so this is only a
> theoretical issue. But it is good practice to exit the loop early if
> we can so the patch still makes sense.
> 
> Also, please use the correct subject prefix: drm/gma500: instead of
> just gma500:.

I will resend another patch as you suggested, thank you.

--
Xiaomeng Tong
diff mbox series

Patch

diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index 42d1a733e124..85fc61bf333a 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -134,6 +134,8 @@  static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
 			is_tv = true;
 			break;
 		}
+
+		break;
 	}
 
 	refclk = 96000;