diff mbox

[2/4] lib: fwts_acpi_tables: set count correctly on error

Message ID 1429790258-19416-3-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King April 23, 2015, 11:57 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

On a scandir failure count is -1 and should be in set to zero.
Also, remove the error message since the failure to get ACPI tables
is reported by all the callers to fwts_acpi_load_tables_from_file_generic
so the error message is unnecessary.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_acpi_tables.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Alex Hung April 29, 2015, 2:17 p.m. UTC | #1
On 15-04-23 07:57 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> On a scandir failure count is -1 and should be in set to zero.
> Also, remove the error message since the failure to get ACPI tables
> is reported by all the callers to fwts_acpi_load_tables_from_file_generic
> so the error message is unnecessary.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_acpi_tables.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 08230f8..24a724e 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -696,8 +696,7 @@ static int fwts_acpi_load_tables_from_file_generic(
>   	 * in some form of deterministic order
>   	 */
>   	if ((*count = scandir(acpi_table_path, &dir_entries, 0, alphasort)) < 0) {
> -		fwts_log_error(fw, "Cannot open directory '%s' to read ACPI tables.",
> -			acpi_table_path);
> +		*count = 0;
>   		return FWTS_ERROR;
>   	}
>   
Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu May 8, 2015, 3:46 a.m. UTC | #2
On 2015年04月23日 19:57, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> On a scandir failure count is -1 and should be in set to zero.
> Also, remove the error message since the failure to get ACPI tables
> is reported by all the callers to fwts_acpi_load_tables_from_file_generic
> so the error message is unnecessary.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_acpi_tables.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 08230f8..24a724e 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -696,8 +696,7 @@ static int fwts_acpi_load_tables_from_file_generic(
>   	 * in some form of deterministic order
>   	 */
>   	if ((*count = scandir(acpi_table_path, &dir_entries, 0, alphasort)) < 0) {
> -		fwts_log_error(fw, "Cannot open directory '%s' to read ACPI tables.",
> -			acpi_table_path);
> +		*count = 0;
>   		return FWTS_ERROR;
>   	}
>   

Acked-by: Ivan Hu<ivan.hu@canonical.com>
diff mbox

Patch

diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index 08230f8..24a724e 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -696,8 +696,7 @@  static int fwts_acpi_load_tables_from_file_generic(
 	 * in some form of deterministic order
 	 */
 	if ((*count = scandir(acpi_table_path, &dir_entries, 0, alphasort)) < 0) {
-		fwts_log_error(fw, "Cannot open directory '%s' to read ACPI tables.",
-			acpi_table_path);
+		*count = 0;
 		return FWTS_ERROR;
 	}