* [PATCH 1/2] drm/nouveau: Handle NVIF_CONN_TV and fix error cleanup in nouveau_connector_create()
2026-11-19 17:03 [PATCH 0/2] drm/nouveau: Two fixes from Clang warning audit Ian Rogers
@ 2026-11-19 17:03 ` Ian Rogers
2026-11-19 17:03 ` [PATCH 2/2] drm/nouveau/kms: Initialize primary_crc for RG CRC capture on GB20x Ian Rogers
1 sibling, 0 replies; 3+ messages in thread
From: Ian Rogers @ 2026-11-19 17:03 UTC (permalink / raw)
To: Lyude Paul, Danilo Krummrich, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, nouveau, linux-kernel, llvm, Elkin Cruz, Ian Rogers
In nouveau_connector_create(), the switch translating nvif connector
types (nv_connector->conn.info.type) to DCB connector types omits
NVIF_CONN_TV, even though nvkm_uconn_new() maps DCB TV connectors to
NVIF_CONN_V0_TV -> NVIF_CONN_TV and the rest of nouveau_connector.c
handles DCB_CONNECTOR_TV_0.
Furthermore, the default branch returns NULL without destroying
nv_connector->conn or freeing nv_connector, whereas both callers
(nv50_display_create() and nv04_display_create()) check only
IS_ERR(connector) and immediately dereference connector on NULL.
Map NVIF_CONN_TV to DCB_CONNECTOR_TV_0, and clean up nv_connector->conn
and nv_connector before returning ERR_PTR(-EINVAL) in the default
branch.
Found by enabling Clang's -Wswitch-enum on an x86_64 allyesconfig build,
with AI coding assistant help to audit the warning and prepare the fix.
Build-tested with Clang; not runtime-tested on NVIDIA GPU hardware.
Fixes: 8b7d92cad953 ("drm/nouveau/kms/nv50-: create connectors based on nvkm info")
Signed-off-by: Ian Rogers <irogers@google.com>
---
drivers/gpu/drm/nouveau/nouveau_connector.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index cc3caf8de64b..51580824df36 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1394,6 +1394,9 @@ nouveau_connector_create(struct drm_device *dev, int index)
switch (nv_connector->conn.info.type) {
case NVIF_CONN_VGA : type = DCB_CONNECTOR_VGA; break;
+ case NVIF_CONN_TV:
+ type = DCB_CONNECTOR_TV_0;
+ break;
case NVIF_CONN_DVI_I : type = DCB_CONNECTOR_DVI_I; break;
case NVIF_CONN_DVI_D : type = DCB_CONNECTOR_DVI_D; break;
case NVIF_CONN_LVDS : type = DCB_CONNECTOR_LVDS; break;
@@ -1403,7 +1406,9 @@ nouveau_connector_create(struct drm_device *dev, int index)
case NVIF_CONN_HDMI : type = DCB_CONNECTOR_HDMI_0; break;
default:
WARN_ON(1);
- return NULL;
+ nvif_conn_dtor(&nv_connector->conn);
+ kfree(nv_connector);
+ return ERR_PTR(-EINVAL);
}
nv_connector->type = type;
--
2.56.1.708.g77570a6a1d-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] drm/nouveau/kms: Initialize primary_crc for RG CRC capture on GB20x
2026-11-19 17:03 [PATCH 0/2] drm/nouveau: Two fixes from Clang warning audit Ian Rogers
2026-11-19 17:03 ` [PATCH 1/2] drm/nouveau: Handle NVIF_CONN_TV and fix error cleanup in nouveau_connector_create() Ian Rogers
@ 2026-11-19 17:03 ` Ian Rogers
1 sibling, 0 replies; 3+ messages in thread
From: Ian Rogers @ 2026-11-19 17:03 UTC (permalink / raw)
To: Lyude Paul, Danilo Krummrich, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, nouveau, linux-kernel, llvm, Elkin Cruz, Ian Rogers
In crcca7d_set_src(), selecting the "rg" CRC source passes
NV50_CRC_SOURCE_TYPE_RG, hitting the default case without initializing
primary_crc before packing it into HEAD_SET_CRC_CONTROL's PRIMARY_CRC
field.
Initialize primary_crc to NVCA7D_HEAD_SET_CRC_CONTROL_PRIMARY_CRC_NONE
in the default branch, matching crcc37d_set_src() where RG CRC capture
leaves PRIMARY_CRC set to NONE.
Found via Clang -Wconditional-uninitialized on an x86_64 allyesconfig
build. Verified by building drivers/gpu/drm/nouveau/dispnv50/crcca7d.o
with LLVM=1 W=1 (-Werror) and -Wconditional-uninitialized; not
runtime-tested on NVIDIA Blackwell (GB20x) hardware.
Fixes: 6cc6e08d4542 ("drm/nouveau/kms: add support for GB20x")
Signed-off-by: Ian Rogers <irogers@google.com>
---
drivers/gpu/drm/nouveau/dispnv50/crcca7d.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/nouveau/dispnv50/crcca7d.c b/drivers/gpu/drm/nouveau/dispnv50/crcca7d.c
index 912f59aebe87..02db81e5c8a3 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/crcca7d.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/crcca7d.c
@@ -65,6 +65,7 @@ crcca7d_set_src(struct nv50_head *head, int or, enum nv50_crc_source_type source
primary_crc = NVCA7D_HEAD_SET_CRC_CONTROL_PRIMARY_CRC_SF;
break;
default:
+ primary_crc = NVCA7D_HEAD_SET_CRC_CONTROL_PRIMARY_CRC_NONE;
break;
}
--
2.56.1.708.g77570a6a1d-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread