diff mbox

drm/i915/icl: fix icl_unmap/map_plls_to_ports

Message ID 20180521112545.29479-1-mahesh1.kumar@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kumar, Mahesh May 21, 2018, 11:25 a.m. UTC
All connectors may not have best_encoder attached, so don't dereference
encoder pointer for each connector.

Fixes: c27e917e2bda (drm/i915/icl: add basic support for the ICL clocks)
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jani Nikula May 22, 2018, 8:43 a.m. UTC | #1
On Mon, 21 May 2018, Mahesh Kumar <mahesh1.kumar@intel.com> wrote:
> All connectors may not have best_encoder attached, so don't dereference
> encoder pointer for each connector.
>
> Fixes: c27e917e2bda (drm/i915/icl: add basic support for the ICL clocks)
> Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 1665bc588241..9517e002f670 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2473,9 +2473,10 @@ void icl_map_plls_to_ports(struct drm_crtc *crtc,
>  	for_each_new_connector_in_state(old_state, conn, conn_state, i) {
>  		struct intel_encoder *encoder =
>  			to_intel_encoder(conn_state->best_encoder);
> -		enum port port = encoder->port;
> +		enum port port;
>  		uint32_t val;
>  
> +		port = encoder->port;

I presume you meant to add that line below the if statement. ;)

BR,
Jani.

>  		if (conn_state->crtc != crtc)
>  			continue;
>  
> @@ -2510,11 +2511,12 @@ void icl_unmap_plls_to_ports(struct drm_crtc *crtc,
>  	for_each_old_connector_in_state(old_state, conn, old_conn_state, i) {
>  		struct intel_encoder *encoder =
>  			to_intel_encoder(old_conn_state->best_encoder);
> -		enum port port = encoder->port;
> +		enum port port;
>  
>  		if (old_conn_state->crtc != crtc)
>  			continue;
>  
> +		port = encoder->port;
>  		mutex_lock(&dev_priv->dpll_lock);
>  		I915_WRITE(DPCLKA_CFGCR0_ICL,
>  			   I915_READ(DPCLKA_CFGCR0_ICL) |
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 1665bc588241..9517e002f670 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2473,9 +2473,10 @@  void icl_map_plls_to_ports(struct drm_crtc *crtc,
 	for_each_new_connector_in_state(old_state, conn, conn_state, i) {
 		struct intel_encoder *encoder =
 			to_intel_encoder(conn_state->best_encoder);
-		enum port port = encoder->port;
+		enum port port;
 		uint32_t val;
 
+		port = encoder->port;
 		if (conn_state->crtc != crtc)
 			continue;
 
@@ -2510,11 +2511,12 @@  void icl_unmap_plls_to_ports(struct drm_crtc *crtc,
 	for_each_old_connector_in_state(old_state, conn, old_conn_state, i) {
 		struct intel_encoder *encoder =
 			to_intel_encoder(old_conn_state->best_encoder);
-		enum port port = encoder->port;
+		enum port port;
 
 		if (old_conn_state->crtc != crtc)
 			continue;
 
+		port = encoder->port;
 		mutex_lock(&dev_priv->dpll_lock);
 		I915_WRITE(DPCLKA_CFGCR0_ICL,
 			   I915_READ(DPCLKA_CFGCR0_ICL) |