Message ID | 1621853213-55876-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | Hans Verkuil |
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1ll871-001oko-AT; Mon, 24 May 2021 10:47:07 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232516AbhEXKsc (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Mon, 24 May 2021 06:48:32 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:56560 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232426AbhEXKsa (ORCPT <rfc822;linux-media@vger.kernel.org>); Mon, 24 May 2021 06:48:30 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0UZw1ezY_1621853215; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0UZw1ezY_1621853215) by smtp.aliyun-inc.com(127.0.0.1); Mon, 24 May 2021 18:47:01 +0800 From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> To: alexander.deucher@amd.com Cc: christian.koenig@amd.com, airlied@linux.ie, daniel@ffwll.ch, sumit.semwal@linaro.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Subject: [PATCH] drm/amdgpu: remove unreachable code Date: Mon, 24 May 2021 18:46:53 +0800 Message-Id: <1621853213-55876-1-git-send-email-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -3.1 (---) X-LSpam-Report: No, score=-3.1 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_LOW=-0.7,UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no |
Series |
drm/amdgpu: remove unreachable code
|
|
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
Applied. Thanks! 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 >
Am 24.05.21 um 12:46 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. Mhm, that is a NAK. IIRC we explicitely added that code because some compiler versions complained that we don't return a value at the end of the function. I suggest to drop the return from the default case and the BUG() instead. Regards, Christian. > > 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; > } > > /**
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
On Tue, May 25, 2021 at 11:27 AM Christian König <ckoenig.leichtzumerken@gmail.com> wrote: > > 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. > I can revert it. Alex > 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 --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; } /**