From 3311ff9f87c9885938ff3db38dd231d926128ce9 Mon Sep 17 00:00:00 2001 From: xiongchangwu Date: Thu, 18 Jul 2024 14:46:46 +0800 Subject: [PATCH] del driverPath check Signed-off-by: xiongchangwu --- adapter/uhdf2/host/src/driver_loader_full.c | 24 ++------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/adapter/uhdf2/host/src/driver_loader_full.c b/adapter/uhdf2/host/src/driver_loader_full.c index ed1006af3..ed55d4110 100644 --- a/adapter/uhdf2/host/src/driver_loader_full.c +++ b/adapter/uhdf2/host/src/driver_loader_full.c @@ -27,35 +27,15 @@ #define DRIVER_DESC "driverDesc" #define HDF_LOG_TAG driver_loader_full -#ifdef __ARCH64__ -#define DRIVER_PATH HDF_LIBRARY_DIR"64/" -#else -#define DRIVER_PATH HDF_LIBRARY_DIR"/" -#endif static struct DriverLoaderFull *g_fullLoader = NULL; struct HdfDriver *HdfDriverLoaderGetDriver(const char *moduleName) { - char realPath[PATH_MAX] = {0}; - char driverPath[PATH_MAX] = {0}; if (moduleName == NULL) { return NULL; } - if (strcat_s(driverPath, sizeof(driverPath) - 1, DRIVER_PATH) != EOK) { - return NULL; - } - - if (strcat_s(driverPath, (sizeof(driverPath) - 1 - sizeof(DRIVER_PATH)), moduleName) != EOK) { - return NULL; - } - - if (realpath(driverPath, realPath) == NULL) { - HDF_LOGE("%{public}s no valid, errno:%{public}d", driverPath, errno); - return NULL; - } - struct HdfDriver *driver = OsalMemAlloc(sizeof(struct HdfDriver)); if (driver == NULL) { return NULL; @@ -63,14 +43,14 @@ struct HdfDriver *HdfDriverLoaderGetDriver(const char *moduleName) void *handle = dlopen(moduleName, RTLD_LAZY); if (handle == NULL) { - HDF_LOGE("get driver entry failed, %{public}s load fail, %{public}s", realPath, dlerror()); + HDF_LOGE("get driver handle, %{public}s dlopen failed, %{public}s", moduleName, dlerror()); OsalMemFree(driver); return NULL; } struct HdfDriverEntry **driverEntry = (struct HdfDriverEntry **)dlsym(handle, DRIVER_DESC); if (driverEntry == NULL) { - HDF_LOGE("driver entry %{public}s dlsym failed", realPath); + HDF_LOGE("get driver entry %{public}s dlsym failed", moduleName); dlclose(handle); OsalMemFree(driver); return NULL; -- Gitee