Skip to contentSkip to conversation

nouveau: Add missing break statement

PATCH Applied Chaitanya Kumar Borah 3 participants 3 messages Apr 30, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: Add missing break statement

Add the missing break statement that causes the following build error

	  CC [M]  drivers/gpu/drm/i915/display/intel_display_device.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:
	      |   ^~~~~~~
	  CC [M]  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.o
	  HDRTEST drivers/gpu/drm/xe/compat-i915-headers/i915_reg.h
	  CC [M]  drivers/gpu/drm/amd/amdgpu/imu_v11_0.o
	make[7]: *** [../scripts/Makefile.build:244: drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.o] Error 1
	make[7]: *** Waiting for unfinished jobs....
---
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +1 -0
index 0b46db5c77b8..63619512e7f6 100644
@@ -1264,6 +1264,7 @@ static void build_registry(struct nvkm_gsp *gsp, PACKED_REGISTRY_TABLE *registry
 			str_offset += reg->vlen;
 			break;
 		default:
+			break;
 		}
 
 		i++;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Chaitanya Kumar Borah

Add the missing break statement that causes the following build error

	  CC [M]  drivers/gpu/drm/i915/display/intel_display_device.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:
	      |   ^~~~~~~
	  CC [M]  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.o
	  HDRTEST drivers/gpu/drm/xe/compat-i915-headers/i915_reg.h
	  CC [M]  drivers/gpu/drm/amd/amdgpu/imu_v11_0.o
	make[7]: *** [../scripts/Makefile.build:244: drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.o] Error 1
	make[7]: *** Waiting for unfinished jobs....
Quoted 2 lines
Fixes b58a0bc904ff ("nouveau: add command-line GSP-RM registry support")

Just found a previous bug report, so we can add here:

Quoted 10 lines

---
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 1 +

1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +0 -0
index 0b46db5c77b8..63619512e7f6 100644

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c static void build_registry(struct nvkm_gsp *gsp, PACKED_REGISTRY_TABLE *registry · line 1267

Quoted 4 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +1 -0
@@ -1264,6 +1264,7 @@ static void build_registry(struct nvkm_gsp *gsp, PACKED_REGISTRY_TABLE *registry
 			str_offset += reg->vlen;
 			break;
 		default:
+			break;

since reg->type is an enum and we are handling all the values, another possible approach is to remove the default handling and then the compiler will warn you of missing cases if built with -Wswitch.

Any of the approaches seem good to me.

Lucas De Marchi

Quoted 6 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +0 -0
 		}
 
 		i++;
Signature · 1 line
2.25.1
#2 lore raw
In reply to Chaitanya Kumar Borah
Quoted 13 lines · Chaitanya Kumar Borah

Add the missing break statement that causes the following build error

	  CC [M]  drivers/gpu/drm/i915/display/intel_display_device.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:
	      |   ^~~~~~~
	  CC [M]  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.o
	  HDRTEST drivers/gpu/drm/xe/compat-i915-headers/i915_reg.h
	  CC [M]  drivers/gpu/drm/amd/amdgpu/imu_v11_0.o
	make[7]: *** [../scripts/Makefile.build:244: drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.o] Error 1
	make[7]: *** Waiting for unfinished jobs....
Quoted 3 lines

Applied to drm-misc-next, thanks!

Quoted 16 lines
---
  drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +1 -0
index 0b46db5c77b8..63619512e7f6 100644
@@ -1264,6 +1264,7 @@ static void build_registry(struct nvkm_gsp *gsp, PACKED_REGISTRY_TABLE *registry
  			str_offset += reg->vlen;
  			break;
  		default:
+			break;
  		}
 
  		i++;