[drm-next] drm/amd/powerplay: remove redundant duplicated return check

Submitted by Colin King on Aug. 5, 2019, 10:29 a.m.

Details

Message ID 20190805102940.26024-1-colin.king@canonical.com
State New
Headers show
Series "drm/amd/powerplay: remove redundant duplicated return check" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Colin King Aug. 5, 2019, 10:29 a.m.
From: Colin Ian King <colin.king@canonical.com>

The check on ret is duplicated in two places, it is redundant code.
Remove it.

Addresses-Coverity: ("Logically dead code")
Fixes: b94afb61cdae ("drm/amd/powerplay: honor hw limit on fetching metrics data for navi10")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 4 ----
 1 file changed, 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index d62c2784b102..b272c8dc8f79 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -941,8 +941,6 @@  static int navi10_get_gpu_power(struct smu_context *smu, uint32_t *value)
 	ret = navi10_get_metrics_table(smu, &metrics);
 	if (ret)
 		return ret;
-	if (ret)
-		return ret;
 
 	*value = metrics.AverageSocketPower << 8;
 
@@ -1001,8 +999,6 @@  static int navi10_get_fan_speed_rpm(struct smu_context *smu,
 	ret = navi10_get_metrics_table(smu, &metrics);
 	if (ret)
 		return ret;
-	if (ret)
-		return ret;
 
 	*speed = metrics.CurrFanSpeed;
 

Comments

Thanks! Reviewed-by: Evan Quan <evan.quan@amd.com>

> -----Original Message-----

> From: Colin King <colin.king@canonical.com>

> Sent: Monday, August 05, 2019 6:30 PM

> To: Rex Zhu <rex.zhu@amd.com>; Quan, Evan <Evan.Quan@amd.com>;

> Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian

> <Christian.Koenig@amd.com>; Zhou, David(ChunMing)

> <David1.Zhou@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter

> <daniel@ffwll.ch>; amd-gfx@lists.freedesktop.org; dri-

> devel@lists.freedesktop.org

> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org

> Subject: [PATCH][drm-next] drm/amd/powerplay: remove redundant

> duplicated return check

> 

> From: Colin Ian King <colin.king@canonical.com>

> 

> The check on ret is duplicated in two places, it is redundant code.

> Remove it.

> 

> Addresses-Coverity: ("Logically dead code")

> Fixes: b94afb61cdae ("drm/amd/powerplay: honor hw limit on fetching

> metrics data for navi10")

> Signed-off-by: Colin Ian King <colin.king@canonical.com>

> ---

>  drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 4 ----

>  1 file changed, 4 deletions(-)

> 

> diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c

> b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c

> index d62c2784b102..b272c8dc8f79 100644

> --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c

> +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c

> @@ -941,8 +941,6 @@ static int navi10_get_gpu_power(struct smu_context

> *smu, uint32_t *value)

>  	ret = navi10_get_metrics_table(smu, &metrics);

>  	if (ret)

>  		return ret;

> -	if (ret)

> -		return ret;

> 

>  	*value = metrics.AverageSocketPower << 8;

> 

> @@ -1001,8 +999,6 @@ static int navi10_get_fan_speed_rpm(struct

> smu_context *smu,

>  	ret = navi10_get_metrics_table(smu, &metrics);

>  	if (ret)

>  		return ret;

> -	if (ret)

> -		return ret;

> 

>  	*speed = metrics.CurrFanSpeed;

> 

> --

> 2.20.1
Applied.  thanks!

Alex

On Mon, Aug 5, 2019 at 6:29 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The check on ret is duplicated in two places, it is redundant code.
> Remove it.
>
> Addresses-Coverity: ("Logically dead code")
> Fixes: b94afb61cdae ("drm/amd/powerplay: honor hw limit on fetching metrics data for navi10")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> index d62c2784b102..b272c8dc8f79 100644
> --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> @@ -941,8 +941,6 @@ static int navi10_get_gpu_power(struct smu_context *smu, uint32_t *value)
>         ret = navi10_get_metrics_table(smu, &metrics);
>         if (ret)
>                 return ret;
> -       if (ret)
> -               return ret;
>
>         *value = metrics.AverageSocketPower << 8;
>
> @@ -1001,8 +999,6 @@ static int navi10_get_fan_speed_rpm(struct smu_context *smu,
>         ret = navi10_get_metrics_table(smu, &metrics);
>         if (ret)
>                 return ret;
> -       if (ret)
> -               return ret;
>
>         *speed = metrics.CurrFanSpeed;
>
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel