diff mbox series

opal: clean up some coding style issues

Message ID 20210922095117.160289-1-colin.king@canonical.com
State Accepted
Headers show
Series opal: clean up some coding style issues | expand

Commit Message

Colin Ian King Sept. 22, 2021, 9:51 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Ensure code keeps to the informal fwts coding style, minor coding
style clean-ups.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/opal/cpu_info.c | 20 ++++++++++----------
 src/opal/mem_info.c |  4 ++--
 src/opal/mtd_info.c |  1 -
 src/opal/pci_info.c |  2 +-
 4 files changed, 13 insertions(+), 14 deletions(-)

Comments

Alex Hung Sept. 22, 2021, 7:07 p.m. UTC | #1
On 2021-09-22 3:51 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Ensure code keeps to the informal fwts coding style, minor coding
> style clean-ups.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/opal/cpu_info.c | 20 ++++++++++----------
>  src/opal/mem_info.c |  4 ++--
>  src/opal/mtd_info.c |  1 -
>  src/opal/pci_info.c |  2 +-
>  4 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c
> index a3e46239..a7022d24 100644
> --- a/src/opal/cpu_info.c
> +++ b/src/opal/cpu_info.c
> @@ -63,7 +63,7 @@ static int get_xscom_property(fwts_framework *fw,
>  						property,
>  						prop_buf,
>  						prop_len)) {
> -							failures ++;
> +							failures++;
>  					}
>  					fwts_passed(fw,
>  						"OPAL CPU Info Property of"
> @@ -73,7 +73,7 @@ static int get_xscom_property(fwts_framework *fw,
>  						my_path,
>  						prop_buf);
>  				} else {
> -					failures ++;
> +					failures++;
>  					fwts_log_nl(fw);
>  					fwts_failed(fw,
>  						LOG_LEVEL_CRITICAL,
> @@ -95,7 +95,7 @@ static int get_xscom_property(fwts_framework *fw,
>  					property, my_path);
>  			}
>  		} else {
> -			failures ++;
> +			failures++;
>  			fwts_log_nl(fw);
>  			fwts_failed(fw, LOG_LEVEL_CRITICAL,
>  				"OPAL CPU Info",
> @@ -105,7 +105,7 @@ static int get_xscom_property(fwts_framework *fw,
>  				my_path, property);
>  		}
>  	} else {
> -		failures ++;
> +		failures++;
>  		fwts_log_nl(fw);
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL,
>  			"OPAL CPU Info",
> @@ -180,27 +180,27 @@ static int get_linux_xscom_devices(fwts_framework *fw)
>  			}
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_SLOT_LOC)) {
> -				failures ++;
> +				failures++;
>  			}
>  
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_PART_NUM)) {
> -				failures ++;
> +				failures++;
>  			}
>  
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_SERIAL_NUM)) {
> -				failures ++;
> +				failures++;
>  			}
>  
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_VENDOR)) {
> -				failures ++;
> +				failures++;
>  			}
>  
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_BOARD_INFO)) {
> -				failures ++;
> +				failures++;
>  			}
>  			fwts_log_nl(fw);
>  			free(cpus);
> @@ -214,7 +214,7 @@ static int get_linux_xscom_devices(fwts_framework *fw)
>  	fwts_log_nl(fw);
>  
>  	if (!found) {
> -		failures ++;
> +		failures++;
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL,
>  			"OPAL CPU Info",
>  			"No CPU devices (xscom@X) were found in \"%s\"."
> diff --git a/src/opal/mem_info.c b/src/opal/mem_info.c
> index a5291e28..d5c12dc9 100644
> --- a/src/opal/mem_info.c
> +++ b/src/opal/mem_info.c
> @@ -171,6 +171,8 @@ static int process_dimm(
>  		}
>  
>  		if (strstr(my_buffer, my_string)) {
> +			char my_prop_string[15];
> +
>  			found = true;
>  			if (asprintf(&my_path,
>  				"%s/%s",
> @@ -190,7 +192,6 @@ static int process_dimm(
>  				continue;
>  			}
>  
> -			char my_prop_string[15];
>  			strcpy(my_prop_string, "/memory-buffer");
>  			if (check_status_property_okay(fw, my_path,
>  						my_prop_string,
> @@ -221,7 +222,6 @@ static int process_dimm(
>  					failures++;
>  				}
>  			}
> -
>  			free(my_path);
>  			free(my_buffer);
>  			free(namelist[i]);
> diff --git a/src/opal/mtd_info.c b/src/opal/mtd_info.c
> index 4a00fc46..79b0be6c 100644
> --- a/src/opal/mtd_info.c
> +++ b/src/opal/mtd_info.c
> @@ -318,7 +318,6 @@ static int mtd_info_test1(fwts_framework *fw)
>  			}
>  			free(mtd_device_path);
>  		}
> -
>  		free(namelist[i]);
>  	}
>  	free(namelist);
> diff --git a/src/opal/pci_info.c b/src/opal/pci_info.c
> index 6ee5ea47..b641651e 100644
> --- a/src/opal/pci_info.c
> +++ b/src/opal/pci_info.c
> @@ -315,7 +315,7 @@ static int get_linux_pci_devices(fwts_framework *fw)
>  	fwts_log_nl(fw);
>  
>  	if (!found) {
> -		failures ++;
> +		failures++;
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL,
>  				"OPAL PCI Info",
>  				"No root PCI devices (xxxx:00:00.0) were found"
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Sept. 23, 2021, 3:40 a.m. UTC | #2
On 9/22/21 5:51 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Ensure code keeps to the informal fwts coding style, minor coding
> style clean-ups.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/opal/cpu_info.c | 20 ++++++++++----------
>  src/opal/mem_info.c |  4 ++--
>  src/opal/mtd_info.c |  1 -
>  src/opal/pci_info.c |  2 +-
>  4 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c
> index a3e46239..a7022d24 100644
> --- a/src/opal/cpu_info.c
> +++ b/src/opal/cpu_info.c
> @@ -63,7 +63,7 @@ static int get_xscom_property(fwts_framework *fw,
>  						property,
>  						prop_buf,
>  						prop_len)) {
> -							failures ++;
> +							failures++;
>  					}
>  					fwts_passed(fw,
>  						"OPAL CPU Info Property of"
> @@ -73,7 +73,7 @@ static int get_xscom_property(fwts_framework *fw,
>  						my_path,
>  						prop_buf);
>  				} else {
> -					failures ++;
> +					failures++;
>  					fwts_log_nl(fw);
>  					fwts_failed(fw,
>  						LOG_LEVEL_CRITICAL,
> @@ -95,7 +95,7 @@ static int get_xscom_property(fwts_framework *fw,
>  					property, my_path);
>  			}
>  		} else {
> -			failures ++;
> +			failures++;
>  			fwts_log_nl(fw);
>  			fwts_failed(fw, LOG_LEVEL_CRITICAL,
>  				"OPAL CPU Info",
> @@ -105,7 +105,7 @@ static int get_xscom_property(fwts_framework *fw,
>  				my_path, property);
>  		}
>  	} else {
> -		failures ++;
> +		failures++;
>  		fwts_log_nl(fw);
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL,
>  			"OPAL CPU Info",
> @@ -180,27 +180,27 @@ static int get_linux_xscom_devices(fwts_framework *fw)
>  			}
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_SLOT_LOC)) {
> -				failures ++;
> +				failures++;
>  			}
>  
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_PART_NUM)) {
> -				failures ++;
> +				failures++;
>  			}
>  
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_SERIAL_NUM)) {
> -				failures ++;
> +				failures++;
>  			}
>  
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_VENDOR)) {
> -				failures ++;
> +				failures++;
>  			}
>  
>  			if (get_xscom_property(fw, xscom_path, false,
>  						DT_PROPERTY_OPAL_BOARD_INFO)) {
> -				failures ++;
> +				failures++;
>  			}
>  			fwts_log_nl(fw);
>  			free(cpus);
> @@ -214,7 +214,7 @@ static int get_linux_xscom_devices(fwts_framework *fw)
>  	fwts_log_nl(fw);
>  
>  	if (!found) {
> -		failures ++;
> +		failures++;
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL,
>  			"OPAL CPU Info",
>  			"No CPU devices (xscom@X) were found in \"%s\"."
> diff --git a/src/opal/mem_info.c b/src/opal/mem_info.c
> index a5291e28..d5c12dc9 100644
> --- a/src/opal/mem_info.c
> +++ b/src/opal/mem_info.c
> @@ -171,6 +171,8 @@ static int process_dimm(
>  		}
>  
>  		if (strstr(my_buffer, my_string)) {
> +			char my_prop_string[15];
> +
>  			found = true;
>  			if (asprintf(&my_path,
>  				"%s/%s",
> @@ -190,7 +192,6 @@ static int process_dimm(
>  				continue;
>  			}
>  
> -			char my_prop_string[15];
>  			strcpy(my_prop_string, "/memory-buffer");
>  			if (check_status_property_okay(fw, my_path,
>  						my_prop_string,
> @@ -221,7 +222,6 @@ static int process_dimm(
>  					failures++;
>  				}
>  			}
> -
>  			free(my_path);
>  			free(my_buffer);
>  			free(namelist[i]);
> diff --git a/src/opal/mtd_info.c b/src/opal/mtd_info.c
> index 4a00fc46..79b0be6c 100644
> --- a/src/opal/mtd_info.c
> +++ b/src/opal/mtd_info.c
> @@ -318,7 +318,6 @@ static int mtd_info_test1(fwts_framework *fw)
>  			}
>  			free(mtd_device_path);
>  		}
> -
>  		free(namelist[i]);
>  	}
>  	free(namelist);
> diff --git a/src/opal/pci_info.c b/src/opal/pci_info.c
> index 6ee5ea47..b641651e 100644
> --- a/src/opal/pci_info.c
> +++ b/src/opal/pci_info.c
> @@ -315,7 +315,7 @@ static int get_linux_pci_devices(fwts_framework *fw)
>  	fwts_log_nl(fw);
>  
>  	if (!found) {
> -		failures ++;
> +		failures++;
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL,
>  				"OPAL PCI Info",
>  				"No root PCI devices (xxxx:00:00.0) were found"
> 

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

Patch

diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c
index a3e46239..a7022d24 100644
--- a/src/opal/cpu_info.c
+++ b/src/opal/cpu_info.c
@@ -63,7 +63,7 @@  static int get_xscom_property(fwts_framework *fw,
 						property,
 						prop_buf,
 						prop_len)) {
-							failures ++;
+							failures++;
 					}
 					fwts_passed(fw,
 						"OPAL CPU Info Property of"
@@ -73,7 +73,7 @@  static int get_xscom_property(fwts_framework *fw,
 						my_path,
 						prop_buf);
 				} else {
-					failures ++;
+					failures++;
 					fwts_log_nl(fw);
 					fwts_failed(fw,
 						LOG_LEVEL_CRITICAL,
@@ -95,7 +95,7 @@  static int get_xscom_property(fwts_framework *fw,
 					property, my_path);
 			}
 		} else {
-			failures ++;
+			failures++;
 			fwts_log_nl(fw);
 			fwts_failed(fw, LOG_LEVEL_CRITICAL,
 				"OPAL CPU Info",
@@ -105,7 +105,7 @@  static int get_xscom_property(fwts_framework *fw,
 				my_path, property);
 		}
 	} else {
-		failures ++;
+		failures++;
 		fwts_log_nl(fw);
 		fwts_failed(fw, LOG_LEVEL_CRITICAL,
 			"OPAL CPU Info",
@@ -180,27 +180,27 @@  static int get_linux_xscom_devices(fwts_framework *fw)
 			}
 			if (get_xscom_property(fw, xscom_path, false,
 						DT_PROPERTY_OPAL_SLOT_LOC)) {
-				failures ++;
+				failures++;
 			}
 
 			if (get_xscom_property(fw, xscom_path, false,
 						DT_PROPERTY_OPAL_PART_NUM)) {
-				failures ++;
+				failures++;
 			}
 
 			if (get_xscom_property(fw, xscom_path, false,
 						DT_PROPERTY_OPAL_SERIAL_NUM)) {
-				failures ++;
+				failures++;
 			}
 
 			if (get_xscom_property(fw, xscom_path, false,
 						DT_PROPERTY_OPAL_VENDOR)) {
-				failures ++;
+				failures++;
 			}
 
 			if (get_xscom_property(fw, xscom_path, false,
 						DT_PROPERTY_OPAL_BOARD_INFO)) {
-				failures ++;
+				failures++;
 			}
 			fwts_log_nl(fw);
 			free(cpus);
@@ -214,7 +214,7 @@  static int get_linux_xscom_devices(fwts_framework *fw)
 	fwts_log_nl(fw);
 
 	if (!found) {
-		failures ++;
+		failures++;
 		fwts_failed(fw, LOG_LEVEL_CRITICAL,
 			"OPAL CPU Info",
 			"No CPU devices (xscom@X) were found in \"%s\"."
diff --git a/src/opal/mem_info.c b/src/opal/mem_info.c
index a5291e28..d5c12dc9 100644
--- a/src/opal/mem_info.c
+++ b/src/opal/mem_info.c
@@ -171,6 +171,8 @@  static int process_dimm(
 		}
 
 		if (strstr(my_buffer, my_string)) {
+			char my_prop_string[15];
+
 			found = true;
 			if (asprintf(&my_path,
 				"%s/%s",
@@ -190,7 +192,6 @@  static int process_dimm(
 				continue;
 			}
 
-			char my_prop_string[15];
 			strcpy(my_prop_string, "/memory-buffer");
 			if (check_status_property_okay(fw, my_path,
 						my_prop_string,
@@ -221,7 +222,6 @@  static int process_dimm(
 					failures++;
 				}
 			}
-
 			free(my_path);
 			free(my_buffer);
 			free(namelist[i]);
diff --git a/src/opal/mtd_info.c b/src/opal/mtd_info.c
index 4a00fc46..79b0be6c 100644
--- a/src/opal/mtd_info.c
+++ b/src/opal/mtd_info.c
@@ -318,7 +318,6 @@  static int mtd_info_test1(fwts_framework *fw)
 			}
 			free(mtd_device_path);
 		}
-
 		free(namelist[i]);
 	}
 	free(namelist);
diff --git a/src/opal/pci_info.c b/src/opal/pci_info.c
index 6ee5ea47..b641651e 100644
--- a/src/opal/pci_info.c
+++ b/src/opal/pci_info.c
@@ -315,7 +315,7 @@  static int get_linux_pci_devices(fwts_framework *fw)
 	fwts_log_nl(fw);
 
 	if (!found) {
-		failures ++;
+		failures++;
 		fwts_failed(fw, LOG_LEVEL_CRITICAL,
 				"OPAL PCI Info",
 				"No root PCI devices (xxxx:00:00.0) were found"