drm/amd/pm: fix return value in aldebaran_set_mp1_state()
Subsystems (3)
PATCH 1/1 drm/amd/pm: fix return value in aldebaran_set_mp1_state()
We should just return error in invalid case. For valid but not implemented one, do nothing and return 0. Otherwise resume will abort because of the wrong return value.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +4 -2
@@ -1781,13 +1781,15 @@ static int aldebaran_set_mp1_state(struct smu_context *smu, enum pp_mp1_state mp1_state) {switch (mp1_state) { +case PP_MP1_STATE_NONE : +case PP_MP1_STATE_RESET : +case PP_MP1_STATE_SHUTDOWN : +return 0 ;case PP_MP1_STATE_UNLOAD :return smu_cmn_set_mp1_state (smu, mp1_state);default :return -EINVAL ; } - -return 0 ; }static const struct pptable_funcs aldebaran_ppt_funcs = {
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
This now handles all of the states. Those states are not valid (and therefore not handled) for Aldebaran. If the intent is to skip handling of any other state, may be just return 0 for default or skip default altogether so that it falls through to return 0 for any other state.
In any case,
Quoted 32 lines · Feifei Xu
We should just return error in invalid case. For valid but not implemented one, do nothing and return 0. Otherwise resume will abort because of the wrong return value.
Signed-off-by Feifei Xu <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +4
-2@@ -1781,13 +1781,15 @@ static int aldebaran_set_mp1_state(struct smu_context *smu, enum pp_mp1_state mp1_state) {switch (mp1_state) { +case PP_MP1_STATE_NONE : +case PP_MP1_STATE_RESET : +case PP_MP1_STATE_SHUTDOWN : +return 0 ;case PP_MP1_STATE_UNLOAD :return smu_cmn_set_mp1_state (smu, mp1_state);default :return -EINVAL ; } - -return 0 ; }static const struct pptable_funcs aldebaran_ppt_funcs = {
Signature · 6 lines
Thanks, Lijo _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Xu, Feifei
Reviewed-by Lijo Lazar[AMD Official Use Only]
PP_MP1_STATE_NONE should be valid while other 2 are not for Aldebaran for now. It depends on whether driver want to throw out error if the msg fall out of the 4 cases. Benefit of handling all the cases will be catching potential bugs easily. But the handling of these 4 and others are the same in both driver and PMFW - which should skip and return 0. So I am ok with the simplify code logic. Will take your suggestion which return 0 for default. Thanks.
Thanks,
Feifei
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, May 20, 2021 7:19 PM
To: Xu, Feifei <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amd/pm: fix return value in aldebaran_set_mp1_state()
This now handles all of the states. Those states are not valid (and therefore not handled) for Aldebaran. If the intent is to skip handling of any other state, may be just return 0 for default or skip default altogether so that it falls through to return 0 for any other state.
In any case,
Quoted 23 lines · Feifei Xu
We should just return error in invalid case. For valid but not implemented one, do nothing and return 0. Otherwise resume will abort because of the wrong return value.
Signed-off-by Feifei Xu <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +4
-0@@ -1781,13 +1781,15 @@ static int aldebaran_set_mp1_state(struct smu_context *smu, enum pp_mp1_state mp1_state) {switch (mp1_state) { +case PP_MP1_STATE_NONE : +case PP_MP1_STATE_RESET : +case PP_MP1_STATE_SHUTDOWN : +return 0 ;
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_set_mp1_state(struct smu_context *smu, · line 1795
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-2case PP_MP1_STATE_UNLOAD :return smu_cmn_set_mp1_state (smu, mp1_state);default :return -EINVAL ; } - -return 0 ; }static const struct pptable_funcs aldebaran_ppt_funcs = {
--
Thanks,
Lijo
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx