All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	uma.shankar@intel.com, chaitanya.kumar.borah@intel.com
Subject: Re: [PATCH] drm/i915/cdclk: Check cdclk value before division
Date: Wed, 9 Oct 2024 12:01:50 +0300	[thread overview]
Message-ID: <ZwZGfsLsy3G-iayh@intel.com> (raw)
In-Reply-To: <20241009084634.1801800-1-suraj.kandpal@intel.com>

On Wed, Oct 09, 2024 at 02:16:34PM +0530, Suraj Kandpal wrote:
> Check cdclk value to avoid a divide by zero error. Since
> bxt_cdclk_init_hw has cdclk can end up being 0 and then
> we have a call to bxt_set_cdclk where we may end up dividing
> this value by 0.

Not possible unless someone completely screwed the
cdclk tables and/or refclk readout, in which case
oops seems like a perfectly reasonable outcome to me.

> 
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index fa1c2012b10c..a5acc70fb87c 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -1921,7 +1921,7 @@ static u32 xe2lpd_mdclk_source_sel(struct intel_display *display)
>  int intel_mdclk_cdclk_ratio(struct intel_display *display,
>  			    const struct intel_cdclk_config *cdclk_config)
>  {
> -	if (mdclk_source_is_cdclk_pll(display))
> +	if (mdclk_source_is_cdclk_pll(display) && cdclk_config->cdclk)
>  		return DIV_ROUND_UP(cdclk_config->vco, cdclk_config->cdclk);
>  
>  	/* Otherwise, source for MDCLK is CD2XCLK. */
> -- 
> 2.43.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-10-09  9:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09  8:46 [PATCH] drm/i915/cdclk: Check cdclk value before division Suraj Kandpal
2024-10-09  9:01 ` Ville Syrjälä [this message]
2024-10-09  9:25   ` Kandpal, Suraj
2024-10-09 10:10 ` ✓ Fi.CI.BAT: success for " Patchwork
2024-10-09 11:34 ` ✓ CI.Patch_applied: " Patchwork
2024-10-09 11:34 ` ✓ CI.checkpatch: " Patchwork
2024-10-09 11:36 ` ✓ CI.KUnit: " Patchwork
2024-10-09 11:48 ` ✓ CI.Build: " Patchwork
2024-10-09 11:50 ` ✓ CI.Hooks: " Patchwork
2024-10-09 11:52 ` ✗ CI.checksparse: warning " Patchwork
2024-10-09 12:12 ` ✓ CI.BAT: success " Patchwork
2024-10-09 18:44 ` ✗ CI.FULL: failure " Patchwork
2024-10-10 11:45 ` ✗ Fi.CI.IGT: " 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=ZwZGfsLsy3G-iayh@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=suraj.kandpal@intel.com \
    --cc=uma.shankar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.