mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Remove useless else if
@ 2023-03-09  3:36 Jiapeng Chong
  2023-03-09  3:50 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-03-09  3:36 UTC (permalink / raw)
  To: alexander.deucher
  Cc: christian.koenig, Xinhui.Pan, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel, Jiapeng Chong, Abaci Robot

The assignment of the else and if branches is the same, so the if else
here is redundant, so we remove it.

./drivers/gpu/drm/amd/amdgpu/nv.c:1048:2-4: WARNING: possible condition with no effect (if == else).

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4454
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/gpu/drm/amd/amdgpu/nv.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
index 855d390c41de..84803929f7d9 100644
--- a/drivers/gpu/drm/amd/amdgpu/nv.c
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c
@@ -1045,19 +1045,11 @@ static int nv_common_late_init(void *handle)
 
 	if (amdgpu_sriov_vf(adev)) {
 		xgpu_nv_mailbox_get_irq(adev);
-		if (adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0) {
-			amdgpu_virt_update_sriov_video_codec(adev,
-							     sriov_sc_video_codecs_encode_array,
-							     ARRAY_SIZE(sriov_sc_video_codecs_encode_array),
-							     sriov_sc_video_codecs_decode_array_vcn1,
-							     ARRAY_SIZE(sriov_sc_video_codecs_decode_array_vcn1));
-		} else {
-			amdgpu_virt_update_sriov_video_codec(adev,
-							     sriov_sc_video_codecs_encode_array,
-							     ARRAY_SIZE(sriov_sc_video_codecs_encode_array),
-							     sriov_sc_video_codecs_decode_array_vcn1,
-							     ARRAY_SIZE(sriov_sc_video_codecs_decode_array_vcn1));
-		}
+		amdgpu_virt_update_sriov_video_codec(adev,
+						     sriov_sc_video_codecs_encode_array,
+						     ARRAY_SIZE(sriov_sc_video_codecs_encode_array),
+						     sriov_sc_video_codecs_decode_array_vcn1,
+						     ARRAY_SIZE(sriov_sc_video_codecs_decode_array_vcn1));
 	}
 
 	return 0;
-- 
2.20.1.7.g153144c


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: Remove useless else if
  2023-03-09  3:36 [PATCH] drm/amdgpu: Remove useless else if Jiapeng Chong
@ 2023-03-09  3:50 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2023-03-09  3:50 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: alexander.deucher, Xinhui.Pan, Abaci Robot, linux-kernel,
	amd-gfx, dri-devel, christian.koenig

On Wed, Mar 8, 2023 at 10:37 PM Jiapeng Chong
<jiapeng.chong@linux.alibaba.com> wrote:
>
> The assignment of the else and if branches is the same, so the if else
> here is redundant, so we remove it.
>
> ./drivers/gpu/drm/amd/amdgpu/nv.c:1048:2-4: WARNING: possible condition with no effect (if == else).
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4454
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/nv.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
> index 855d390c41de..84803929f7d9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/nv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/nv.c
> @@ -1045,19 +1045,11 @@ static int nv_common_late_init(void *handle)
>
>         if (amdgpu_sriov_vf(adev)) {
>                 xgpu_nv_mailbox_get_irq(adev);
> -               if (adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0) {
> -                       amdgpu_virt_update_sriov_video_codec(adev,
> -                                                            sriov_sc_video_codecs_encode_array,
> -                                                            ARRAY_SIZE(sriov_sc_video_codecs_encode_array),
> -                                                            sriov_sc_video_codecs_decode_array_vcn1,
> -                                                            ARRAY_SIZE(sriov_sc_video_codecs_decode_array_vcn1));
> -               } else {
> -                       amdgpu_virt_update_sriov_video_codec(adev,
> -                                                            sriov_sc_video_codecs_encode_array,
> -                                                            ARRAY_SIZE(sriov_sc_video_codecs_encode_array),
> -                                                            sriov_sc_video_codecs_decode_array_vcn1,
> -                                                            ARRAY_SIZE(sriov_sc_video_codecs_decode_array_vcn1));

This should be vcn0.  I'll send out a patch.  Thanks!

Alex


> -               }
> +               amdgpu_virt_update_sriov_video_codec(adev,
> +                                                    sriov_sc_video_codecs_encode_array,
> +                                                    ARRAY_SIZE(sriov_sc_video_codecs_encode_array),
> +                                                    sriov_sc_video_codecs_decode_array_vcn1,
> +                                                    ARRAY_SIZE(sriov_sc_video_codecs_decode_array_vcn1));
>         }
>
>         return 0;
> --
> 2.20.1.7.g153144c
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-09  3:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09  3:36 [PATCH] drm/amdgpu: Remove useless else if Jiapeng Chong
2023-03-09  3:50 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®