From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Jouni Högander" <jouni.hogander@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/i915/psr: check drm_mode_vrefresh return value
Date: Thu, 21 Aug 2025 16:10:54 +0300 [thread overview]
Message-ID: <aKca3nYynsprAZU1@intel.com> (raw)
In-Reply-To: <20250821045918.17757-2-jouni.hogander@intel.com>
On Thu, Aug 21, 2025 at 07:59:18AM +0300, Jouni Högander wrote:
> Check drm_mode_vrefresh return value sanity before using it in
> intel_get_frame_time_us.
>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_psr.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index 5addde63168e..8cc2314fac6f 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1116,11 +1116,16 @@ transcoder_has_psr2(struct intel_display *display, enum transcoder cpu_transcode
>
> static u32 intel_get_frame_time_us(const struct intel_crtc_state *crtc_state)
> {
> + int vrefresh;
> +
> if (!crtc_state->hw.active)
> return 0;
>
> - return DIV_ROUND_UP(1000 * 1000,
> - drm_mode_vrefresh(&crtc_state->hw.adjusted_mode));
> + vrefresh = drm_mode_vrefresh(&crtc_state->hw.adjusted_mode);
> + if (vrefresh <= 0)
How would that happen?
> + return 0;
> +
> + return DIV_ROUND_UP(1000 * 1000, vrefresh);
> }
>
> static void psr2_program_idle_frames(struct intel_dp *intel_dp,
> --
> 2.43.0
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2025-08-21 13:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 4:59 [PATCH v2 1/2] drm/i915/psr: Check drm_dp_dpcd_read return value on PSR dpcd init Jouni Högander
2025-08-21 4:59 ` [PATCH v2 2/2] drm/i915/psr: check drm_mode_vrefresh return value Jouni Högander
2025-08-21 7:42 ` Jani Nikula
2025-08-21 13:10 ` Ville Syrjälä [this message]
2025-08-22 5:07 ` Hogander, Jouni
2025-08-22 14:12 ` Ville Syrjälä
2025-08-22 14:51 ` Hogander, Jouni
2025-08-21 7:42 ` [PATCH v2 1/2] drm/i915/psr: Check drm_dp_dpcd_read return value on PSR dpcd init Jani Nikula
2025-08-25 6:22 ` Hogander, Jouni
2025-08-21 9:40 ` ✓ i915.CI.BAT: success for series starting with [v2,1/2] " Patchwork
2025-08-21 12:43 ` ✓ i915.CI.Full: " Patchwork
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=aKca3nYynsprAZU1@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jouni.hogander@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;
as well as URLs for NNTP newsgroup(s).