[PATCH 2/2] drm/i915/hdcp: fix intel_hdcp_get_repeater_ctl() error return value

Jani Nikula jani.nikula at intel.com
Tue Dec 19 16:22:24 UTC 2023


On Tue, 19 Dec 2023, Ville Syrjälä <ville.syrjala at linux.intel.com> wrote:
> On Tue, Dec 19, 2023 at 12:47:46PM +0200, Jani Nikula wrote:
>> intel_hdcp_get_repeater_ctl() is supposed to return unsigned register
>> contents. Returning negative error values is unexpected, and none of the
>> callers check for that.
>> 
>> Sort of fix the error cases by returning 0. I don't think we should hit
>> these cases anyway, and using 0 for the registers is safer than
>> 0xffffffea (-EINVAL).
>> 
>> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_hdcp.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
>> index f9010094ff29..ee29fcb860e4 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
>> @@ -347,7 +347,7 @@ u32 intel_hdcp_get_repeater_ctl(struct drm_i915_private *i915,
>>  		default:
>>  			drm_err(&i915->drm, "Unknown transcoder %d\n",
>>  				cpu_transcoder);
>
> These should probably be MISSING_CASE() as well.

Yeah, maybe. For another day...

>
> Anyways,
> Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Thanks, both pushed.

BR,
Jani.

>
>> -			return -EINVAL;
>> +			return 0;
>>  		}
>>  	}
>>  
>> @@ -364,7 +364,7 @@ u32 intel_hdcp_get_repeater_ctl(struct drm_i915_private *i915,
>>  		return HDCP_DDIE_REP_PRESENT | HDCP_DDIE_SHA1_M0;
>>  	default:
>>  		drm_err(&i915->drm, "Unknown port %d\n", port);
>> -		return -EINVAL;
>> +		return 0;
>>  	}
>>  }
>>  
>> -- 
>> 2.39.2

-- 
Jani Nikula, Intel


More information about the Intel-gfx mailing list