diff mbox series

acpi: macf: report failures instead of just logging the errors

Message ID 20220303084128.32123-1-ivan.hu@canonical.com
State Superseded
Headers show
Series acpi: macf: report failures instead of just logging the errors | expand

Commit Message

ivanhu March 3, 2022, 8:41 a.m. UTC
buglink: https://bugs.launchpad.net/fwts/+bug/1962629

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/acpi/mcfg/mcfg.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Rebecca Cran March 4, 2022, 9:59 p.m. UTC | #1
On 3/3/22 01:41, Ivan Hu wrote:
> -		fwts_log_error(fw, "Cannot mmap PCI config space at 0x%" PRIx64 ".",
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "MMapUnmapable",
> +			"Cannot mmap PCI config space at 0x%" PRIx64 ".",
>   			config->base_address);
>   		return FWTS_ERROR;
Should this be "MMapUnmappable" with two 'p's?
ivanhu March 7, 2022, 9:25 a.m. UTC | #2
Typo, will send out V2

On 3/3/22 16:41, Ivan Hu wrote:
> buglink: https://bugs.launchpad.net/fwts/+bug/1962629
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/acpi/mcfg/mcfg.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c
> index 1c8b4b13..1aafea94 100644
> --- a/src/acpi/mcfg/mcfg.c
> +++ b/src/acpi/mcfg/mcfg.c
> @@ -54,25 +54,27 @@ static int compare_config_space(
>  		config->pci_segment_group_number);
>  
>  	if ((fp = fopen(path, "r")) == NULL) {
> -		fwts_log_warning(fw, "Could not open %s.", path);
> +		fwts_warning(fw, "Could not open %s.", path);
>  		return FWTS_ERROR;
>  	}
>  	n = fread(config_space, 1, sizeof(config_space), fp);
>  	(void)fclose(fp);
>  	if (n != sizeof(config_space)) {
> -		fwts_log_warning(fw, "Could only read %zd bytes from %s, expecting %zd.", n, path, sizeof(config_space));
> +		fwts_warning(fw, "Could only read %zd bytes from %s, expecting %zd.", n, path, sizeof(config_space));
>  		return FWTS_ERROR;
>  	}
>  
>  	if ((mapped_config_space = fwts_mmap(config->base_address, page_size)) == FWTS_MAP_FAILED) {
> -		fwts_log_error(fw, "Cannot mmap PCI config space at 0x%" PRIx64 ".",
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "MMapUnmapable",
> +			"Cannot mmap PCI config space at 0x%" PRIx64 ".",
>  			config->base_address);
>  		return FWTS_ERROR;
>  	}
>  
>  	/* We only need to check if just the config space is readable */
>  	if (fwts_safe_memread(mapped_config_space, sizeof(config_space)) != FWTS_OK) {
> -		fwts_log_error(fw, "Cannot read PCI config space at 0x%" PRIx64 ".",
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "PCIUnreadable",
> +			"Cannot read PCI config space at 0x%" PRIx64 ".",
>  			config->base_address);
>  		(void)fwts_munmap(mapped_config_space, page_size);
>  		return FWTS_ERROR;
diff mbox series

Patch

diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c
index 1c8b4b13..1aafea94 100644
--- a/src/acpi/mcfg/mcfg.c
+++ b/src/acpi/mcfg/mcfg.c
@@ -54,25 +54,27 @@  static int compare_config_space(
 		config->pci_segment_group_number);
 
 	if ((fp = fopen(path, "r")) == NULL) {
-		fwts_log_warning(fw, "Could not open %s.", path);
+		fwts_warning(fw, "Could not open %s.", path);
 		return FWTS_ERROR;
 	}
 	n = fread(config_space, 1, sizeof(config_space), fp);
 	(void)fclose(fp);
 	if (n != sizeof(config_space)) {
-		fwts_log_warning(fw, "Could only read %zd bytes from %s, expecting %zd.", n, path, sizeof(config_space));
+		fwts_warning(fw, "Could only read %zd bytes from %s, expecting %zd.", n, path, sizeof(config_space));
 		return FWTS_ERROR;
 	}
 
 	if ((mapped_config_space = fwts_mmap(config->base_address, page_size)) == FWTS_MAP_FAILED) {
-		fwts_log_error(fw, "Cannot mmap PCI config space at 0x%" PRIx64 ".",
+		fwts_failed(fw, LOG_LEVEL_MEDIUM, "MMapUnmapable",
+			"Cannot mmap PCI config space at 0x%" PRIx64 ".",
 			config->base_address);
 		return FWTS_ERROR;
 	}
 
 	/* We only need to check if just the config space is readable */
 	if (fwts_safe_memread(mapped_config_space, sizeof(config_space)) != FWTS_OK) {
-		fwts_log_error(fw, "Cannot read PCI config space at 0x%" PRIx64 ".",
+		fwts_failed(fw, LOG_LEVEL_MEDIUM, "PCIUnreadable",
+			"Cannot read PCI config space at 0x%" PRIx64 ".",
 			config->base_address);
 		(void)fwts_munmap(mapped_config_space, page_size);
 		return FWTS_ERROR;