ch_driver: Don't lock driver when getting version

In chConnectGetVersion() the CH driver is locked in order to read
driver->version. This is needless, because not only is the
version set with driver unlocked (chStateInitialize() calls
chExtractVersion() which sets the version), but the version is
practically immutable. Once driver initialized itself it's never
changed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
Michal Privoznik 2022-02-10 15:28:47 +01:00
parent d192e522ef
commit 31ef66f12e

View File

@ -106,9 +106,7 @@ static int chConnectGetVersion(virConnectPtr conn,
if (virConnectGetVersionEnsureACL(conn) < 0)
return -1;
chDriverLock(driver);
*version = driver->version;
chDriverUnlock(driver);
return 0;
}