2023-05-17 18:39:18

by Hamza Mahfooz

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

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 <[email protected]>
Signed-off-by: Hamza Mahfooz <[email protected]>
---
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;

--
2.40.1



2023-05-17 18:50:42

by Hamza Mahfooz

[permalink] [raw]
Subject: [PATCH 3/3] drm/amd/display: drop unused count variable in create_eml_sink()

Since, we are only interested in having
drm_edid_override_connector_update(), update the value of
connector->edid_blob_ptr. We don't care about the return value of
drm_edid_override_connector_update() here. So, drop count.

Fixes: 068553e14f86 ("drm/amd/display: assign edid_blob_ptr with edid from debugfs")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Hamza Mahfooz <[email protected]>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 14b296e1d0f6..5a2d04f47276 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -6396,9 +6396,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
/* if connector->edid_override valid, pass
* it to edid_override to edid_blob_ptr
*/
- int count;

- count = drm_edid_override_connector_update(&aconnector->base);
+ drm_edid_override_connector_update(&aconnector->base);

if (!aconnector->base.edid_blob_ptr) {
DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
--
2.40.1


2023-05-18 00:15:43

by Rodrigo Siqueira Jordao

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm/amd/display: drop redundant memset() in get_available_dsc_slices()



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 <[email protected]>
> Signed-off-by: Hamza Mahfooz <[email protected]>
> ---
> 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 <[email protected]>

2023-05-18 00:40:48

by Rodrigo Siqueira Jordao

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/amd/display: drop unused count variable in create_eml_sink()



On 5/17/23 12:33, Hamza Mahfooz wrote:
> Since, we are only interested in having
> drm_edid_override_connector_update(), update the value of
> connector->edid_blob_ptr. We don't care about the return value of
> drm_edid_override_connector_update() here. So, drop count.
>
> Fixes: 068553e14f86 ("drm/amd/display: assign edid_blob_ptr with edid from debugfs")
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Hamza Mahfooz <[email protected]>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 14b296e1d0f6..5a2d04f47276 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -6396,9 +6396,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
> /* if connector->edid_override valid, pass
> * it to edid_override to edid_blob_ptr
> */
> - int count;
>
> - count = drm_edid_override_connector_update(&aconnector->base);
> + drm_edid_override_connector_update(&aconnector->base);
>
> if (!aconnector->base.edid_blob_ptr) {
> DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",

Reviewed-by: Rodrigo Siqueira <[email protected]>


2023-05-18 06:41:30

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm/amd/display: drop redundant memset() in get_available_dsc_slices()


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 <[email protected]>
> Signed-off-by: Hamza Mahfooz <[email protected]>
> ---
> 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 <[email protected]>