From 3a367c5a472201e250e308fb19b07c2acc8f75ff Mon Sep 17 00:00:00 2001 From: Oleh Nykyforchyn Date: Sat, 27 Dec 2025 23:03:39 +0200 Subject: [PATCH] xfree86/common: omit unnecessary search for matching devices It is patch 3/3 of a series that makes adding GPU screens more controllable. If AutoAddGPU is "off", matching devices for autoconfigured drivers are sought for anyway, and then the unused list is freed. This patch cancels an unnecessary search. Signed-off-by: Oleh Nykyforchyn --- hw/xfree86/common/xf86platformBus.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index 1fd4514a3e..0f3a9d3659 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -640,20 +640,18 @@ xf86platformAddGPUDevices(DriverPtr drvp) GDevPtr *devList; int j; - if (!drvp->platformProbe) + if (!drvp->platformProbe || !xf86Info.autoAddGPU) return FALSE; xf86MatchDevice(drvp->driverName, &devList); /* if autoaddgpu devices is enabled then go find any unclaimed platform * devices and add them as GPU screens */ - if (xf86Info.autoAddGPU) { - for (j = 0; j < xf86_num_platform_devices; j++) { - if (probeSingleDevice(&xf86_platform_devices[j], drvp, - devList ? devList[0] : NULL, - PLATFORM_PROBE_GPU_SCREEN)) - foundScreen = TRUE; - } + for (j = 0; j < xf86_num_platform_devices; j++) { + if (probeSingleDevice(&xf86_platform_devices[j], drvp, + devList ? devList[0] : NULL, + PLATFORM_PROBE_GPU_SCREEN)) + foundScreen = TRUE; } free(devList);