[igt-dev] [i-g-t V2] lib/igt_kms: Don't read max dotclock on non-display platforms

Modem, Bhanuprakash bhanuprakash.modem at intel.com
Thu Nov 16 03:30:12 UTC 2023


On Thu-16-11-2023 02:16 am, Ville Syrjälä wrote:
> On Wed, Nov 15, 2023 at 07:32:31PM +0530, Bhanuprakash Modem wrote:
>> On non-display platforms, there is no point in checking for
>> max dotclock.
>>
>> V2: Fix resource leak
>>
>> Fixes: https://gitlab.freedesktop.org/drm/intel/-/issues/9672
>> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
>> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
>> ---
>>   lib/igt_kms.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 89510ff22..0aa8f4a46 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -6055,10 +6055,18 @@ int igt_get_max_dotclock(int fd)
>>   	char buf[4096];
>>   	char *s;
>>   	int dir, res, max_dotclock = 0;
>> +	drmModeRes *resources;
>>   
>>   	if (!is_intel_device(fd))
>>   		return max_dotclock;
>>   
>> +	/* If there is no display, then no point to check for dotclock. */
>> +	resources = drmModeGetResources(fd);
>> +	if (!resources)
>> +		return max_dotclock;
>> +	else
>> +		drmModeFreeResources(resources);
> 
> Not a big fan of the use of 'else' here. So I'd drop that.
> 
> But otherwise looks fine, so
> Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> However a simpler approach could be to just drop the old
> i915_frequency_info fallback and simply return 0 on failure
> to read i915_cdclk_info.

Sure, I'll float a separate patch for this change.

- Bhanu

> 
>> +
>>   	dir = igt_debugfs_dir(fd);
>>   	igt_require(dir);
>>   
>> -- 
>> 2.40.0
> 


More information about the igt-dev mailing list