Re: [PATCH] drm/amd/powerplay: Move fallthrough; into containing #ifdef/#endif

From: Alex Deucher
Date: Fri Mar 13 2020 - 10:23:02 EST


On Fri, Mar 13, 2020 at 8:59 AM Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> The automated conversion of /* fallthrough */ comments converted
> a comment outside of an #ifdef/#endif case block that should be
> inside the block.
>
> Move the fallthrough inside the block to silence the warning.
>
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>

Applied. Thanks!

Alex

> ---
>
> On Fri, 2020-03-13 at 20:57 +1100, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the amdgpu tree, today's linux-next build (powerpc
> > allyesconfig) produced this warning:
> >
> > In file included from include/linux/compiler_types.h:59,
> > from <command-line>:
> > drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c: In function 'smu7_request_link_speed_change_before_state_change':
> > include/linux/compiler_attributes.h:200:41: warning: statement will never be executed [-Wswitch-unreachable]
> > 200 | # define fallthrough __attribute__((__fallthrough__))
> > | ^~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:3706:4: note: in expansion of macro 'fallthrough'
> > 3706 | fallthrough;
> > | ^~~~~~~~~~~
> >
> > Introduced by commit
> >
> > e86efa063cd1 ("AMD POWERPLAY: Use fallthrough;")
>
> This is also one of the #ifdef/#endif pairs
> where the fallthrough is outside of the #endif.
>
> https://lore.kernel.org/lkml/cover.1584040050.git.joe@xxxxxxxxxxx/
>
> Here is a delta patch for this.
> Let me know if another form is needed.
>
> drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> index fc5236c..774048 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> @@ -3702,8 +3702,8 @@ static int smu7_request_link_speed_change_before_state_change(
> case PP_PCIEGen2:
> if (0 == amdgpu_acpi_pcie_performance_request(hwmgr->adev, PCIE_PERF_REQ_GEN2, false))
> break;
> -#endif
> fallthrough;
> +#endif
> default:
> data->force_pcie_gen = smu7_get_current_pcie_speed(hwmgr);
> break;
> --
> 2.24.0
>
>