diff mbox

drm/i915/sdvo: fix questionable return value check

Message ID 1395406593-28213-1-git-send-email-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula March 21, 2014, 12:56 p.m. UTC
intel_sdvo_get_trained_inputs() returns a bool, check the status
accordingly.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

Spotted while reading code, compile tested only.
---
 drivers/gpu/drm/i915/intel_sdvo.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Daniel Vetter March 21, 2014, 2:37 p.m. UTC | #1
On Fri, Mar 21, 2014 at 02:56:32PM +0200, Jani Nikula wrote:
> intel_sdvo_get_trained_inputs() returns a bool, check the status
> accordingly.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> ---

Will be interesting to see whether this catches anything ... Queued for
-next, thanks for the patch.
-Daniel
> 
> Spotted while reading code, compile tested only.
> ---
>  drivers/gpu/drm/i915/intel_sdvo.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 9a0b71f6aed6..d27155adf5db 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1461,7 +1461,7 @@ static void intel_enable_sdvo(struct intel_encoder *encoder)
>  	u32 temp;
>  	bool input1, input2;
>  	int i;
> -	u8 status;
> +	bool success;
>  
>  	temp = I915_READ(intel_sdvo->sdvo_reg);
>  	if ((temp & SDVO_ENABLE) == 0) {
> @@ -1475,12 +1475,12 @@ static void intel_enable_sdvo(struct intel_encoder *encoder)
>  	for (i = 0; i < 2; i++)
>  		intel_wait_for_vblank(dev, intel_crtc->pipe);
>  
> -	status = intel_sdvo_get_trained_inputs(intel_sdvo, &input1, &input2);
> +	success = intel_sdvo_get_trained_inputs(intel_sdvo, &input1, &input2);
>  	/* Warn if the device reported failure to sync.
>  	 * A lot of SDVO devices fail to notify of sync, but it's
>  	 * a given it the status is a success, we succeeded.
>  	 */
> -	if (status == SDVO_CMD_STATUS_SUCCESS && !input1) {
> +	if (success && !input1) {
>  		DRM_DEBUG_KMS("First %s output reported failure to "
>  				"sync\n", SDVO_NAME(intel_sdvo));
>  	}
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 9a0b71f6aed6..d27155adf5db 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1461,7 +1461,7 @@  static void intel_enable_sdvo(struct intel_encoder *encoder)
 	u32 temp;
 	bool input1, input2;
 	int i;
-	u8 status;
+	bool success;
 
 	temp = I915_READ(intel_sdvo->sdvo_reg);
 	if ((temp & SDVO_ENABLE) == 0) {
@@ -1475,12 +1475,12 @@  static void intel_enable_sdvo(struct intel_encoder *encoder)
 	for (i = 0; i < 2; i++)
 		intel_wait_for_vblank(dev, intel_crtc->pipe);
 
-	status = intel_sdvo_get_trained_inputs(intel_sdvo, &input1, &input2);
+	success = intel_sdvo_get_trained_inputs(intel_sdvo, &input1, &input2);
 	/* Warn if the device reported failure to sync.
 	 * A lot of SDVO devices fail to notify of sync, but it's
 	 * a given it the status is a success, we succeeded.
 	 */
-	if (status == SDVO_CMD_STATUS_SUCCESS && !input1) {
+	if (success && !input1) {
 		DRM_DEBUG_KMS("First %s output reported failure to "
 				"sync\n", SDVO_NAME(intel_sdvo));
 	}