From 47ac2659d5f8544dcd53aeef13a42b3256f2fd6f Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 8 Dec 2021 10:25:02 +0100 Subject: [PATCH] activate: cache driver_version result --- lib/activate/activate.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 727bd2386..52ec02e2c 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -486,12 +486,20 @@ int library_version(char *version, size_t size) int driver_version(char *version, size_t size) { + static char _vsn[80] = { 0 }; + if (!activation()) return 0; log_very_verbose("Getting driver version"); - return dm_driver_version(version, size); + if (!_vsn[0] && + !dm_driver_version(_vsn, sizeof(_vsn))) + return_0; + + (void) dm_strncpy(version, _vsn, size); + + return 1; } int target_version(const char *target_name, uint32_t *maj,