* [PATCH v2] amdgpu: remove unreachable code
@ 2021-05-25 10:40 Jiapeng Chong
2021-05-25 14:09 ` Christian König
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-05-25 10:40 UTC (permalink / raw)
To: alexander.deucher
Cc: christian.koenig, Xinhui.Pan, airlied, daniel, sumit.semwal,
amd-gfx, dri-devel, linux-kernel, linux-media, linaro-mm-sig,
Jiapeng Chong
In the function amdgpu_uvd_cs_msg(), every branch in the switch
statement will have a return, so the code below the switch statement
will not be executed.
Eliminate the follow smatch warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:845 amdgpu_uvd_cs_msg() warn:
ignoring unreachable code.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
Changes in v2:
-For the follow advice: https://lore.kernel.org/patchwork/patch/1435074/
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index 82f0542..b32ed85 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -840,7 +840,6 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
default:
DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
- return -EINVAL;
}
BUG();
return -EINVAL;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] amdgpu: remove unreachable code
2021-05-25 10:40 [PATCH v2] amdgpu: remove unreachable code Jiapeng Chong
@ 2021-05-25 14:09 ` Christian König
0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2021-05-25 14:09 UTC (permalink / raw)
To: Jiapeng Chong, alexander.deucher
Cc: airlied, Xinhui.Pan, linux-kernel, amd-gfx, sumit.semwal,
linaro-mm-sig, dri-devel, daniel, christian.koenig, linux-media
Am 25.05.21 um 12:40 schrieb Jiapeng Chong:
> In the function amdgpu_uvd_cs_msg(), every branch in the switch
> statement will have a return, so the code below the switch statement
> will not be executed.
>
> Eliminate the follow smatch warning:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:845 amdgpu_uvd_cs_msg() warn:
> ignoring unreachable code.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> Changes in v2:
> -For the follow advice: https://lore.kernel.org/patchwork/patch/1435074/
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index 82f0542..b32ed85 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -840,7 +840,6 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
>
> default:
> DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
> - return -EINVAL;
> }
> BUG();
You also need to remove the BUG() here or otherwise that will crash on
an relatively harmless error.
Christian.
> return -EINVAL;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-25 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 10:40 [PATCH v2] amdgpu: remove unreachable code Jiapeng Chong
2021-05-25 14:09 ` Christian König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).