diff mbox series

[1/3] drm/amd/display: drop redundant memset() in get_available_dsc_slices()

Message ID 20230517183350.314082-1-hamza.mahfooz@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/amd/display: drop redundant memset() in get_available_dsc_slices() | expand

Commit Message

Hamza Mahfooz May 17, 2023, 6:33 p.m. UTC
get_available_dsc_slices() returns the number of indices set, and all of
the users of get_available_dsc_slices() don't cross the returned bound
when iterating over available_slices[]. So, the memset() in
get_available_dsc_slices() is redundant and can be dropped.

Fixes: 97bda0322b8a ("drm/amd/display: Add DSC support for Navi (v2)")
Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Rodrigo Siqueira Jordao May 18, 2023, 12:01 a.m. UTC | #1
On 5/17/23 12:33, Hamza Mahfooz wrote:
> get_available_dsc_slices() returns the number of indices set, and all of
> the users of get_available_dsc_slices() don't cross the returned bound
> when iterating over available_slices[]. So, the memset() in
> get_available_dsc_slices() is redundant and can be dropped.
> 
> Fixes: 97bda0322b8a ("drm/amd/display: Add DSC support for Navi (v2)")
> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
> ---
>   drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
> index b9a05bb025db..58dd62cce4bb 100644
> --- a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
> +++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
> @@ -645,8 +645,6 @@ static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av
>   {
>   	int idx = 0;
>   
> -	memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE);
> -
>   	if (slice_caps.bits.NUM_SLICES_1)
>   		available_slices[idx++] = 1;
>   

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Christophe JAILLET May 18, 2023, 6:28 a.m. UTC | #2
Le 17/05/2023 à 20:33, Hamza Mahfooz a écrit :
> get_available_dsc_slices() returns the number of indices set, and all of
> the users of get_available_dsc_slices() don't cross the returned bound
> when iterating over available_slices[]. So, the memset() in
> get_available_dsc_slices() is redundant and can be dropped.
>
> Fixes: 97bda0322b8a ("drm/amd/display: Add DSC support for Navi (v2)")
> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
> ---
>   drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
> index b9a05bb025db..58dd62cce4bb 100644
> --- a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
> +++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
> @@ -645,8 +645,6 @@ static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av
>   {
>   	int idx = 0;
>   
> -	memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE);
> -
>   	if (slice_caps.bits.NUM_SLICES_1)
>   		available_slices[idx++] = 1;
>   

Thanks for it, it went off my radar.


FWIW:

Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
index b9a05bb025db..58dd62cce4bb 100644
--- a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
+++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
@@ -645,8 +645,6 @@  static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av
 {
 	int idx = 0;
 
-	memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE);
-
 	if (slice_caps.bits.NUM_SLICES_1)
 		available_slices[idx++] = 1;