mirror of
https://github.com/linux-msm/pd-mapper.git
synced 2026-02-25 13:12:10 -08:00
Handle "path not set in sysfs" without extra warnings
Stop printing the obscure warning about path being too long when the firmware path isn't set in sysfs. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
This commit is contained in:
19
pd-mapper.c
19
pd-mapper.c
@@ -195,15 +195,16 @@ static int pd_load_map(const char *file)
|
||||
|
||||
static int concat_path(char *base_path, char *firmware_path, char *path, size_t path_len)
|
||||
{
|
||||
if ((strlen(base_path) > 0) && (strlen(base_path) + 1 + strlen(firmware_path) + 1 < path_len)) {
|
||||
strcpy(path, base_path);
|
||||
strcat(path, "/");
|
||||
strcat(path, firmware_path);
|
||||
return 0;
|
||||
} else {
|
||||
if (strlen(base_path) + 1 + strlen(firmware_path) + 1 >= path_len) {
|
||||
warn("Path length exceeded %lu\n", path_len);
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
|
||||
strcpy(path, base_path);
|
||||
strcat(path, "/");
|
||||
strcat(path, firmware_path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
@@ -230,6 +231,10 @@ static DIR *opendir_firmware(char *firmware_path, char *out_path_opened, size_t
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* path not set in sysfs */
|
||||
if (n <= 1)
|
||||
goto err;
|
||||
|
||||
fw_sysfs_path[n - 1] = '\0';
|
||||
|
||||
ret = concat_path(fw_sysfs_path, firmware_path, out_path_opened, out_path_size);
|
||||
|
||||
Reference in New Issue
Block a user