* [PATCH 0/2] GPU-DRM-i915-DP: Fine-tuning for two function implementations @ 2017-10-24 13:58 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 0 siblings, 2 replies; 4+ messages in thread From: SF Markus Elfring @ 2017-10-24 13:58 UTC (permalink / raw) To: dri-devel, intel-gfx, David Airlie, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi Cc: kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 24 Oct 2017 15:54:32 +0200 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): Delete an unnecessary goto statement in intel_dp_sink_crc() Use common error handling code in intel_dp_sink_crc_stop() drivers/gpu/drm/i915/intel_dp.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) -- 2.14.3 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] drm/i915/dp: Delete an unnecessary goto statement in intel_dp_sink_crc() 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 ` 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 1 sibling, 0 replies; 4+ messages in thread From: SF Markus Elfring @ 2017-10-24 13:59 UTC (permalink / raw) To: dri-devel, intel-gfx, David Airlie, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi Cc: kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 24 Oct 2017 15:15:20 +0200 A jump was specified for a location which was directly behind. Thus remove such an unnecessary goto statement. 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 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ca48bce23a6f..342f1a1fa085 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -3994,10 +3994,8 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) goto stop; } - if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) < 0) { + if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) < 0) ret = -EIO; - goto stop; - } stop: intel_dp_sink_crc_stop(intel_dp); -- 2.14.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/i915/dp: Use common error handling code in intel_dp_sink_crc_stop() 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 ` SF Markus Elfring 2017-10-24 16:13 ` Jani Nikula 1 sibling, 1 reply; 4+ messages in thread From: SF Markus Elfring @ 2017-10-24 14:00 UTC (permalink / raw) To: dri-devel, intel-gfx, David Airlie, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi Cc: kernel-janitors, LKML 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 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; - } + 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; - } 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; } static int intel_dp_sink_crc_start(struct intel_dp *intel_dp) -- 2.14.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] drm/i915/dp: Use common error handling code in intel_dp_sink_crc_stop() 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 0 siblings, 0 replies; 4+ messages in thread From: Jani Nikula @ 2017-10-24 16:13 UTC (permalink / raw) To: SF Markus Elfring, dri-devel, intel-gfx, David Airlie, Joonas Lahtinen, Rodrigo Vivi Cc: kernel-janitors, LKML 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-24 16:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox