From e4c0c0c443057cd004cba7381ca26c027f7ebc2c Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Wed, 15 Feb 2023 14:26:25 -0800 Subject: [PATCH] ANDROID: firmware_loader: Emit empty string when no custom paths firmware_param_path_get will return -1 if no custom firmware paths have been set. Use sysfs_emit_at to form the response string and now emit an empty string as expected when there are no custom firmware paths. Fixes: ce17e299d0f6 ("ANDROID: firmware_loader: Add support for customer firmware paths") Change-Id: If695733c81b3cef105c28dff7a6c1b6e722b2169 Signed-off-by: Elliot Berman --- drivers/base/firmware_loader/main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c index 6966a1854832..9281191d7920 100644 --- a/drivers/base/firmware_loader/main.c +++ b/drivers/base/firmware_loader/main.c @@ -525,14 +525,11 @@ static int firmware_param_path_get(char *buffer, const struct kernel_param *kp) { int count = 0, i; - for (i = 0; i < CUSTOM_FW_PATH_COUNT; i++) { + for (i = 0; i < CUSTOM_FW_PATH_COUNT; i++) if (strlen(fw_path_para[i]) != 0) - count += scnprintf(buffer + count, PATH_SIZE, "%s%s", fw_path_para[i], ","); - } + count += sysfs_emit_at(buffer, count, "%s,", fw_path_para[i]); - buffer[count - 1] = '\0'; - - return count - 1; + return count; } /* * Typical usage is that passing 'firmware_class.path=/vendor,/firwmare_mnt'