aboutsummaryrefslogtreecommitdiff
path: root/tools/power/acpi/tools/acpidump/apfiles.c
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-07-08 10:07:33 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-08 14:22:27 +0200
commitfbee6b21a3820a55ec36a2aceb138f3973a955ac (patch)
treeff0c7ecf0730d9e408cdd9ac1d1dc5fae620da8b /tools/power/acpi/tools/acpidump/apfiles.c
parenta92e95773d8e2cd58124aea147cb833f33f1e196 (diff)
downloadlinux-stericsson-fbee6b21a3820a55ec36a2aceb138f3973a955ac.tar.gz
ACPICA: acpidump: Add memory/string OSL usage to improve portability
This patch adds code to use generic OSL for acpidump to improve the portability of this tool. Lv Zheng. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'tools/power/acpi/tools/acpidump/apfiles.c')
-rw-r--r--tools/power/acpi/tools/acpidump/apfiles.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/power/acpi/tools/acpidump/apfiles.c b/tools/power/acpi/tools/acpidump/apfiles.c
index 4488accc010b..1d12b9d3d44e 100644
--- a/tools/power/acpi/tools/acpidump/apfiles.c
+++ b/tools/power/acpi/tools/acpidump/apfiles.c
@@ -130,11 +130,12 @@ int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
/* Handle multiple SSDts - create different filenames for each */
if (instance > 0) {
- sprintf(instance_str, "%u", instance);
- strcat(filename, instance_str);
+ acpi_ut_snprintf(instance_str, sizeof(instance_str), "%u",
+ instance);
+ ACPI_STRCAT(filename, instance_str);
}
- strcat(filename, ACPI_TABLE_FILE_SUFFIX);
+ ACPI_STRCAT(filename, ACPI_TABLE_FILE_SUFFIX);
if (gbl_verbose_mode) {
fprintf(stderr,
@@ -202,7 +203,7 @@ struct acpi_table_header *ap_get_table_from_file(char *pathname,
/* Allocate a buffer for the entire file */
- buffer = calloc(1, file_size);
+ buffer = ACPI_ALLOCATE_ZEROED(file_size);
if (!buffer) {
fprintf(stderr,
"Could not allocate file buffer of size: %u\n",
@@ -215,7 +216,7 @@ struct acpi_table_header *ap_get_table_from_file(char *pathname,
actual = fread(buffer, 1, file_size, file);
if (actual != file_size) {
fprintf(stderr, "Could not read input file: %s\n", pathname);
- free(buffer);
+ ACPI_FREE(buffer);
buffer = NULL;
goto cleanup;
}