Hi all,

On Wed, 5 Oct 2022 12:45:31 -0400 Hamza Mahfooz <hamza.mahf...@amd.com> wrote:
>
> On 2022-10-05 11:30, Alex Deucher wrote:
> > @Mahfooz, Hamza
> > @Aurabindo Pillai can you get this fixed up?
> >   
> 
> Seems like this is a false positive for GCC versions pre-12, because I'm not 
> seeing this warning on GCC 12.2.
> However, we can fix this for older GCC versions with the following:
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h 
> b/drivers/gpu/drm/amd/display/dc/dc_stream.h
> index 9e6025c98db9..67fede4bf248 100644
> --- a/drivers/gpu/drm/amd/display/dc/dc_stream.h
> +++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h
> @@ -238,7 +238,7 @@ struct dc_stream_state {
> 
>       /* writeback */
>       unsigned int num_wb_info;
> -     struct dc_writeback_info writeback_info[MAX_DWB_PIPES];
> +     struct dc_writeback_info writeback_info[MAX_DWB_PIPES + 1];
>       const struct dc_transfer_func *func_shaper;
>       const struct dc_3dlut *lut3d_func;
>       /* Computed state bits */

This is now in Linus' tree :-(

I have applied the following hack for today:

From: Stephen Rothwell <s...@canb.auug.org.au>
Date: Thu, 6 Oct 2022 09:14:26 +1100
Subject: [PATCH] fix up for drivers/gpu/drm/amd/display/dc/core/dc_stream.c

Signed-off-by: Stephen Rothwell <s...@canb.auug.org.au>
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index ae13887756bf..a5da787b7876 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc,
        }
 
        /* remove writeback info for disabled writeback pipes from stream */
-       for (i = 0, j = 0; i < stream->num_wb_info && j < MAX_DWB_PIPES; i++) {
+       for (i = 0, j = 0; i < stream->num_wb_info && i < MAX_DWB_PIPES; i++) {
                if (stream->writeback_info[i].wb_enabled) {
-                       if (i != j)
+                       if ((j >= 0) && (j < i))
                                /* trim the array */
                                stream->writeback_info[j] = 
stream->writeback_info[i];
                        j++;
-- 
2.35.1

-- 
Cheers,
Stephen Rothwell

Attachment: pgpQz7CGilWZb.pgp
Description: OpenPGP digital signature

Reply via email to