diff mbox series

drm/amd/display: return status of abm_feature_support

Message ID 20230420132129.3888917-1-trix@redhat.com (mailing list archive)
State New, archived
Headers show
Series drm/amd/display: return status of abm_feature_support | expand

Commit Message

Tom Rix April 20, 2023, 1:21 p.m. UTC
gcc with W=1 reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_abm.c:
  In function ‘dmub_abm_set_event_ex’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_abm.c:138:22: error: variable
  ‘feature_support’ set but not used [-Werror=unused-but-set-variable]
  138 |         unsigned int feature_support;
      |                      ^~~~~~~~~~~~~~~

This variable is not used so remove it.
The status of amb_feature_support should have been returned, so
set ret and return it.

Fixes: b8fe56375f78 ("drm/amd/display: Refactor ABM feature")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Hamza Mahfooz April 24, 2023, 4:31 p.m. UTC | #1
On 4/20/23 09:21, Tom Rix wrote:
> gcc with W=1 reports
> drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_abm.c:
>    In function ‘dmub_abm_set_event_ex’:
> drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_abm.c:138:22: error: variable
>    ‘feature_support’ set but not used [-Werror=unused-but-set-variable]
>    138 |         unsigned int feature_support;
>        |                      ^~~~~~~~~~~~~~~
> 
> This variable is not used so remove it.
> The status of amb_feature_support should have been returned, so
> set ret and return it.
> 
> Fixes: b8fe56375f78 ("drm/amd/display: Refactor ABM feature")
> Signed-off-by: Tom Rix <trix@redhat.com>

Since set_abm_event() is never used. I would prefer if it was dropped
entirely.

> ---
>   drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
> index a66f83a61402..8f285c3be4c6 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
> @@ -134,10 +134,9 @@ static bool dmub_abm_set_pipe_ex(struct abm *abm, uint32_t otg_inst, uint32_t op
>   static bool dmub_abm_set_event_ex(struct abm *abm, unsigned int full_screen, unsigned int video_mode,
>   		unsigned int hdr_mode, unsigned int panel_inst)
>   {
> -	bool ret = false;
> -	unsigned int feature_support;
> +	bool ret;
>   
> -	feature_support = abm_feature_support(abm, panel_inst);
> +	ret = abm_feature_support(abm, panel_inst);
>   
>   	return ret;
>   }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
index a66f83a61402..8f285c3be4c6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
@@ -134,10 +134,9 @@  static bool dmub_abm_set_pipe_ex(struct abm *abm, uint32_t otg_inst, uint32_t op
 static bool dmub_abm_set_event_ex(struct abm *abm, unsigned int full_screen, unsigned int video_mode,
 		unsigned int hdr_mode, unsigned int panel_inst)
 {
-	bool ret = false;
-	unsigned int feature_support;
+	bool ret;
 
-	feature_support = abm_feature_support(abm, panel_inst);
+	ret = abm_feature_support(abm, panel_inst);
 
 	return ret;
 }