On Mon, Apr 29, 2024 at 12:40:25PM +0000, Timur Tabi wrote:
> On Mon, 2024-04-29 at 14:49 +0530, MD Danish Anwar wrote:
> > This patch seems to be breaking latest linux-next (tag: next-20240429).
> > While building kernel for arm64 on latest linux-next with defconfig, I
> > see build failure with below error.
> > 
> > ❯ make -j$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu-
> > 
> >   CALL    scripts/checksyscalls.sh
> >   CC [M]  drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.o
> > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c: In function
> > ‘build_registry’:
> > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1266:3: error: label at
> > end of compound statement
> >  1266 |   default:
> >       |   ^~~~~~~
> > make[6]: *** [scripts/Makefile.build:244:
> > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.o] Error 1
> 
> I've been writing C code for 30 years, and I can't remember ever seeing this
> compiler compaint.
> 
>       default:
>       }
> 
> Seems normal to me, and it doesn't fail on x86.  Try adding a "break;" between
> the two lines.
> 

Hi,

this build failure was also reproduced by KernelCI, and I reproduced it locally
too. So indeed this change breaks the build for arm64, with the same error
mentioned above:


  CC [M]  drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.o
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c: In function ‘build_registry’:
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1266:3: error: label at end of 
compound statement
 1266 |   default:
      |   ^~~~~~~
make[6]: *** [scripts/Makefile.build:244: 
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.o] Error 1
make[5]: *** [scripts/Makefile.build:485: drivers/gpu/drm/nouveau] Error 2


Adding a break statement after the default label as you suggested did fix the
issue:


diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
index 0b46db5c77b8..63619512e7f6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
@@ -1264,6 +1264,7 @@ static void build_registry(struct nvkm_gsp *gsp, 
PACKED_REGISTRY_TABLE *registry
                        str_offset += reg->vlen;
                        break;
                default:
+                       break;
                }

                i++;


Feel free to add my T-by when you send the fix:
Tested-by: Nícolas F. R. A. Prado <[email protected]>

#regzbot introduced: b58a0bc904ffa
#regzbot title: arm64 build failure with error 'label at end of compound 
statement' on next-20240429

Thanks,
Nícolas

Reply via email to