diff mbox

drm/amd/powerplay: fix amd_powerplay_reset()

Message ID 20171024094418.za4qacxapyrud2m4@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Oct. 24, 2017, 9:44 a.m. UTC
We accidentally inverted an if statement and turned amd_powerplay_reset()
into a no-op.

Fixes: ae97988fc89e ("drm/amd/powerplay: tidy up ret checks in amd_powerplay.c (v3)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
IMHO, tidying unreadable double negatives is tricky and error prone but
still worth it in the long run.

Comments

Jani Nikula Oct. 24, 2017, 10:11 a.m. UTC | #1
On Tue, 24 Oct 2017, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We accidentally inverted an if statement and turned amd_powerplay_reset()
> into a no-op.
>
> Fixes: ae97988fc89e ("drm/amd/powerplay: tidy up ret checks in amd_powerplay.c (v3)")

For some reason I looked up that commit, and it has *two* cases where
"ret != 0" gets changed to "!ret".

BR,
Jani.


> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> IMHO, tidying unreadable double negatives is tricky and error prone but
> still worth it in the long run.
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> index 3c8ef4bfc205..0f8b6dc853a5 100644
> --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> @@ -1184,7 +1184,7 @@ int amd_powerplay_reset(void *handle)
>  	int ret;
>  
>  	ret = pp_check(instance);
> -	if (!ret)
> +	if (ret)
>  		return ret;
>  
>  	ret = pp_hw_fini(instance);
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dan Carpenter Oct. 24, 2017, 10:31 a.m. UTC | #2
On Tue, Oct 24, 2017 at 01:11:07PM +0300, Jani Nikula wrote:
> On Tue, 24 Oct 2017, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > We accidentally inverted an if statement and turned amd_powerplay_reset()
> > into a no-op.
> >
> > Fixes: ae97988fc89e ("drm/amd/powerplay: tidy up ret checks in amd_powerplay.c (v3)")
> 
> For some reason I looked up that commit, and it has *two* cases where
> "ret != 0" gets changed to "!ret".
> 

The other bug was secretly fixed in commit 3811f8f00c5f ("drm/amd/powerplay:
move set_clockgating_by_smu to pp func table").

regards,
dan carpenter
Alex Deucher Oct. 25, 2017, 10:28 p.m. UTC | #3
On Tue, Oct 24, 2017 at 5:44 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We accidentally inverted an if statement and turned amd_powerplay_reset()
> into a no-op.
>
> Fixes: ae97988fc89e ("drm/amd/powerplay: tidy up ret checks in amd_powerplay.c (v3)")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.  thanks!

Alex

> ---
> IMHO, tidying unreadable double negatives is tricky and error prone but
> still worth it in the long run.
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> index 3c8ef4bfc205..0f8b6dc853a5 100644
> --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> @@ -1184,7 +1184,7 @@ int amd_powerplay_reset(void *handle)
>         int ret;
>
>         ret = pp_check(instance);
> -       if (!ret)
> +       if (ret)
>                 return ret;
>
>         ret = pp_hw_fini(instance);
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 3c8ef4bfc205..0f8b6dc853a5 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -1184,7 +1184,7 @@  int amd_powerplay_reset(void *handle)
 	int ret;
 
 	ret = pp_check(instance);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	ret = pp_hw_fini(instance);