public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>,
	dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	David Airlie <airlied@linux.ie>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: kernel-janitors@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] drm/i915/dp: Use common error handling code in intel_dp_sink_crc_stop()
Date: Tue, 24 Oct 2017 19:13:27 +0300	[thread overview]
Message-ID: <873768h6c8.fsf@intel.com> (raw)
In-Reply-To: <1d3d0395-957a-2a87-3cb5-0d7355d04b65@users.sourceforge.net>

On Tue, 24 Oct 2017, SF Markus Elfring <elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 24 Oct 2017 15:40:47 +0200
>
> Adjust jump targets so that a specific error code assignment
> will be in the implementation only at the end of this function.

This is not an issue that needs to be "fixed".

>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 30 ++++++++++++++----------------
>  1 file changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 342f1a1fa085..3dd514a77008 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3894,27 +3894,19 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp)
>  	int count = 0;
>  	int attempts = 10;
>  
> -	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0) {
> -		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
> -		ret = -EIO;
> -		goto out;
> -	}
> +	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
> +		goto report_failure;
>  
>  	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
> -			       buf & ~DP_TEST_SINK_START) < 0) {
> -		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
> -		ret = -EIO;
> -		goto out;

I'd rather change the debug messages to distinguish the cases. I also
want to keep ret = -EIO in each individual branch, to distinguish from
the cases where it's set to something other than -EIO.

> -	}
> +			       buf & ~DP_TEST_SINK_START) < 0)
> +		goto report_failure;
>  
>  	do {
>  		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
> +		if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf)
> +		    < 0)
> +			goto e_io;
>  
> -		if (drm_dp_dpcd_readb(&intel_dp->aux,
> -				      DP_TEST_SINK_MISC, &buf) < 0) {
> -			ret = -EIO;
> -			goto out;
> -		}

This is good as it is. The change makes it worse.

>  		count = buf & DP_TEST_COUNT_MASK;
>  	} while (--attempts && count);
>  
> @@ -3923,9 +3915,15 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp)
>  		ret = -ETIMEDOUT;
>  	}
>  
> - out:
> +enable_ips:
>  	hsw_enable_ips(intel_crtc);
>  	return ret;
> +
> +report_failure:
> +	DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
> +e_io:
> +	ret = -EIO;
> +	goto enable_ips;

*shudder* Please no.

BR,
Jani.

>  }
>  
>  static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2017-10-24 16:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 13:58 [PATCH 0/2] GPU-DRM-i915-DP: Fine-tuning for two function implementations SF Markus Elfring
2017-10-24 13:59 ` [PATCH 1/2] drm/i915/dp: Delete an unnecessary goto statement in intel_dp_sink_crc() SF Markus Elfring
2017-10-24 14:00 ` [PATCH 2/2] drm/i915/dp: Use common error handling code in intel_dp_sink_crc_stop() SF Markus Elfring
2017-10-24 16:13   ` 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=873768h6c8.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=elfring@users.sourceforge.net \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.vivi@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