Skip to contentSkip to conversation

drm/nouveau: avoid assignment in if condition

PATCH New [email protected] 1 participant 1 message Aug 18, 2025

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

PATCH 1/1 drm/nouveau: avoid assignment in if condition

From: Darshan Rathod <[email protected]>

Move kzalloc assignment out of the if condition to follow kernel coding style guidelines and improve readability.

---
 drivers/gpu/drm/nouveau/nvkm/engine/falcon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/engine/falcon.c +4 -1
index fd5ee9f0af36..46273e6b14ac 100644
@@ -262,6 +262,7 @@ nvkm_falcon_init(struct nvkm_engine *engine)
 	/* upload firmware bootloader (or the full code segments) */
 	if (falcon->core) {
 		u64 addr = nvkm_memory_addr(falcon->core);
+
 		if (device->card_type < NV_C0)
 			nvkm_wr32(device, base + 0x618, 0x04000000);
 		else
@@ -341,8 +342,10 @@ nvkm_falcon_new_(const struct nvkm_falcon_func *func, struct nvkm_device *device
 {
 	struct nvkm_falcon *falcon;
 
-	if (!(falcon = kzalloc(sizeof(*falcon), GFP_KERNEL)))
+	falcon = kzalloc(sizeof(*falcon), GFP_KERNEL);
+	if (!falcon)
 		return -ENOMEM;
+
 	falcon->func = func;
 	falcon->addr = addr;
 	falcon->code.data = func->code.data;
Signature · 1 line
2.25.1