From: Jani Nikula <jani.nikula@linux.intel.com>
To: Jonathan Cavitt <jonathan.cavitt@intel.com>,
intel-gfx@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com, jonathan.cavitt@intel.com
Subject: Re: [PATCH v2] drm/i915/display: PORT_NONE is not valid
Date: Tue, 17 Mar 2026 11:28:29 +0200 [thread overview]
Message-ID: <6597430e6cbeedc11ce9d79967408aa917dfc1fc@intel.com> (raw)
In-Reply-To: <20260123152121.7042-2-jonathan.cavitt@intel.com>
On Fri, 23 Jan 2026, Jonathan Cavitt <jonathan.cavitt@intel.com> wrote:
> Static analysis issue:
>
> In assert_port_valid, add a check to ensure port != PORT_NONE, as that
> is not a valid port. The check must be explicit to prevent a bad bit
> shift operation in the general case via short-circuiting. It's not
> likely this will ever come up in a real use case, but it's at least
> worth guarding against.
>
> It would probably also be pertinent to modify the behavior of the
> port_name function to correctly print PORT_NONE in this case, as
> currently the port would be reported as 'port @' by the debugger. But
> that should be done separately, and given port_name is mostly just a
> debug printing helper function anyways, fixing it is a low priority.
>
> v2:
> - Conditional check was backwards. Fix it. (Jani)
>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
Thanks for the patch, pushed to drm-intel-next.
BR,
Jani.
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 7491e00e3858..0c3bb3f98ee4 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -7828,7 +7828,8 @@ static bool intel_ddi_crt_present(struct intel_display *display)
>
> bool assert_port_valid(struct intel_display *display, enum port port)
> {
> - return !drm_WARN(display->drm, !(DISPLAY_RUNTIME_INFO(display)->port_mask & BIT(port)),
> + return !drm_WARN(display->drm,
> + !(port >= 0 && DISPLAY_RUNTIME_INFO(display)->port_mask & BIT(port)),
> "Platform does not support port %c\n", port_name(port));
> }
--
Jani Nikula, Intel
prev parent reply other threads:[~2026-03-17 9:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 15:21 [PATCH v2] drm/i915/display: PORT_NONE is not valid Jonathan Cavitt
2026-01-23 16:15 ` ✓ i915.CI.BAT: success for drm/i915/display: PORT_NONE is not valid (rev2) Patchwork
2026-01-23 22:29 ` ✗ i915.CI.Full: failure " Patchwork
2026-01-23 22:53 ` Cavitt, Jonathan
2026-01-26 13:21 ` [PATCH v2] drm/i915/display: PORT_NONE is not valid Jani Nikula
2026-03-17 9:28 ` Jani Nikula [this message]
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=6597430e6cbeedc11ce9d79967408aa917dfc1fc@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=alex.zuo@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.com \
--cc=saurabhg.gupta@intel.com \
/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