diff mbox series

drm/amdgpu: remove unreachable code

Message ID 1621853213-55876-1-git-send-email-jiapeng.chong@linux.alibaba.com
State Superseded
Headers show
Series drm/amdgpu: remove unreachable code | expand

Commit Message

Jiapeng Chong May 24, 2021, 10:46 a.m. UTC
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>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Christian König May 25, 2021, 3:27 p.m. UTC | #1
Am 24.05.21 um 20:48 schrieb Alex Deucher:
> Applied.  Thanks!

Ok, that's unfortunate.

IIRC we added the code because of a different compiler warning.

Christian.

>
> Alex
>
> On Mon, May 24, 2021 at 6:47 AM Jiapeng Chong
> <jiapeng.chong@linux.alibaba.com> wrote:
>> 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>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> index 82f0542..375b346 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> @@ -842,8 +842,6 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
>>                  DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
>>                  return -EINVAL;
>>          }
>> -       BUG();
>> -       return -EINVAL;
>>   }
>>
>>   /**
>> --
>> 1.8.3.1
>>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index 82f0542..375b346 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -842,8 +842,6 @@  static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
 		DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
 		return -EINVAL;
 	}
-	BUG();
-	return -EINVAL;
 }
 
 /**