mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: lyude@redhat.com
To: Ian Rogers <irogers@google.com>,
	Danilo Krummrich <dakr@kernel.org>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann	 <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>,
	Simona Vetter	 <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	 linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Elkin Cruz <elkin@google.com>
Subject: Re: [PATCH 1/2] drm/nouveau: Handle NVIF_CONN_TV and fix error cleanup in nouveau_connector_create()
Date: Mon, 30 Nov 2026 19:04:30 -0500	[thread overview]
Message-ID: <b428ecca73fe06438bbf676e8ef1176999308fb7.camel@redhat.com> (raw)
In-Reply-To: <f0db7ca640d19d1021b4031b08be426532425095.1795106937.git.irogers@google.com>

On Thu, 2026-11-19 at 09:03 -0800, Ian Rogers wrote:
> 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;

Make sure that the formatting of patches that you send matches the
formatting of the lines around it

Also, this should be split into two patches.

>  		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;

  reply	other threads:[~2026-12-01  0:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-12-01  0:04   ` lyude [this message]
2026-11-19 17:03 ` [PATCH 2/2] drm/nouveau/kms: Initialize primary_crc for RG CRC capture on GB20x Ian Rogers
2026-12-01  0:06   ` Lyude Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b428ecca73fe06438bbf676e8ef1176999308fb7.camel@redhat.com \
    --to=lyude@redhat.com \
    --cc=airlied@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=elkin@google.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®