Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: "Michał Grzelak" <michal.grzelak@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>,
	"Mika Kahola" <mika.kahola@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>,
	Nemesa Garg <nemesa.garg@intel.com>,
	Jani Nikula <jani.nikula@intel.com>
Subject: Re: [PATCH v1 30/30] drm/i915/dp: return -EINVAL on failure
Date: Thu, 25 Jun 2026 17:15:33 +0300	[thread overview]
Message-ID: <aj04BaDXwD9dRLCF@ideak-desk.lan> (raw)
In-Reply-To: <20260623224619.1949975-31-michal.grzelak@intel.com>

On Wed, Jun 24, 2026 at 12:46:19AM +0200, Michał Grzelak wrote:
> Both intel_dp_rate_index() and intel_dp_link_config_index() in case of
> failure return -1 which equates to -EPERM. Return -EINVAL instead since
> each caller checks for negative error code.
> 
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c           | 2 +-
>  drivers/gpu/drm/i915/display/intel_dp_link_caps.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 66346b74b2c04..1c0b85ac27ad5 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -666,7 +666,7 @@ int intel_dp_rate_index(const int *rates, int len, int rate)
>  		if (rate == rates[i])
>  			return i;
>  
> -	return -1;
> +	return -EINVAL;

I'm not sure about these changes. Both of these functions can fail in
one way and returning an invalid index in that case looks ok to me.

>  }
>  
>  static void intel_dp_get_common_rates(struct intel_dp *intel_dp,
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> index 1c34ba6c49c35..241809e6a9cb2 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> @@ -347,7 +347,7 @@ int intel_dp_link_config_index(struct intel_dp_link_caps *link_caps,
>  			return i;
>  	}
>  
> -	return -1;
> +	return -EINVAL;
>  }
>  
>  /**
> -- 
> 2.45.2
> 

  reply	other threads:[~2026-06-25 14:15 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 22:45 [PATCH v1 00/30] Comments applied to dp_link_caps Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 01/30] drm/i915/dp: Rename intel_dp_link_config to intel_dp_link_config_entry Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 02/30] drm/i915/dp: Add struct intel_dp_link_config Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 03/30] drm/i915/dp_link_caps: Introduce DP link capability module Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 04/30] drm/i915/dp_link_caps: Move common rate helpers to link caps Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 05/30] drm/i915/dp_link_caps: Move forced link param " Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 06/30] drm/i915/dp: Simplify querying of forced link parameters Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 07/30] drm/i915/dp_link_caps: Move forced and max link debugfs entries to link caps Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 08/30] drm/i915/dp_link_training: Use helpers to get forced link params Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 09/30] drm/i915/dp_link_caps: Move forced link params to link_caps Michał Grzelak
2026-06-23 22:45 ` [PATCH v1 10/30] drm/i915/dp_link_caps: Move link config helpers to link caps Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 11/30] drm/i915/dp_link_caps: Move link config tracking to link_caps Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 12/30] drm/i915/dp_link_caps: Rename helper updating the link configurations Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 13/30] drm/i915/dp: Factor out helper to get link rate capabilities Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 14/30] drm/i915/dp_link_caps: Pass supported link rates to link caps update Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 15/30] drm/i915/dp_link_caps: Add helper to print all supported link rates Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 16/30] drm/i915/dp_link_caps: Add helper to get the number of " Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 17/30] drm/i915/dp_link_caps: Add helper to get common rate index Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 18/30] drm/i915/dp_link_caps: Move tracking of common rates to link_caps struct Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 19/30] drm/i915/dp_link_caps: Track max common lane count in link_caps Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 20/30] drm/i915/dp_link_caps: Use max common lane count from link_caps Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 21/30] drm/i915/dp_link_caps: Add helpers to get max link limits Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 22/30] drm/i915/dp_link_caps: Add helpers to set " Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 23/30] drm/i915/dp_link_caps: Add helper to reset " Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 24/30] drm/i915/dp_link_caps: Add helper to reset link_caps state Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 25/30] drm/i915/dp_link_caps: Move max link limits to link_caps Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 26/30] drm/i915/dp_link_caps: Pass link_caps to static functions Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 27/30] drm/i915/dp_link_caps: Pass link_caps to config update/lookup helpers Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 28/30] drm/i915/dp_link_caps: Pass link_caps to common rate helpers Michał Grzelak
2026-06-23 22:46 ` [PATCH v1 29/30] drm/i915/dp_link_caps: s/lc/lce/ Michał Grzelak
2026-06-25 14:13   ` Imre Deak
2026-06-23 22:46 ` [PATCH v1 30/30] drm/i915/dp: return -EINVAL on failure Michał Grzelak
2026-06-25 14:15   ` Imre Deak [this message]
2026-06-25 15:10     ` Michał Grzelak
2026-06-23 23:09 ` ✗ CI.checkpatch: warning for Comments applied to dp_link_caps Patchwork
2026-06-23 23:10 ` ✓ CI.KUnit: success " Patchwork
2026-06-23 23:46 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-24  5:22 ` ✓ Xe.CI.FULL: " Patchwork
2026-06-24  8:12 ` [PATCH v1 00/30] " Jani Nikula
2026-06-24  8:25   ` Michał Grzelak

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=aj04BaDXwD9dRLCF@ideak-desk.lan \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=luciano.coelho@intel.com \
    --cc=michal.grzelak@intel.com \
    --cc=mika.kahola@intel.com \
    --cc=nemesa.garg@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