diff mbox

devicetree: dt_sysinfo: reduce scope of version_buf

Message ID 20170124121824.12673-1-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Jan. 24, 2017, 12:18 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

minor code style change, no functional difference

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/devicetree/dt_sysinfo/dt_sysinfo.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Alex Hung Jan. 25, 2017, 7:20 a.m. UTC | #1
On 2017-01-24 08:18 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> minor code style change, no functional difference
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/devicetree/dt_sysinfo/dt_sysinfo.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c
> index 9c22351..dd160ee 100644
> --- a/src/devicetree/dt_sysinfo/dt_sysinfo.c
> +++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c
> @@ -57,11 +57,10 @@ static int dt_sysinfo_get_version(fwts_framework *fw,
>  				char *firmware)
>  {
>  	int version_len;
> -	const char *version_buf;
>
>  	/* only output if the platform_firmware node is present */
>  	if (node >= 0) {
> -                version_buf = fdt_getprop(fw->fdt, node,
> +                const char *version_buf = fdt_getprop(fw->fdt, node,
>                          firmware, &version_len);
>                  if (version_buf) {
>                          fwts_passed(fw,
> @@ -91,7 +90,6 @@ static int dt_sysinfo_check_version(fwts_framework *fw)
>  	}
>
>  	int node, version_len;
> -	const char *version_buf;
>
>  	fwts_log_info(fw,
>  		"OPAL base device tree path is %s.",
> @@ -99,7 +97,7 @@ static int dt_sysinfo_check_version(fwts_framework *fw)
>  	node = fdt_path_offset(fw->fdt,
>  			opal_firmware);
>  	if (node >= 0) {
> -		version_buf = fdt_getprop(fw->fdt, node,
> +		const char *version_buf = fdt_getprop(fw->fdt, node,
>  			"version", &version_len);
>  		if (version_buf) {
>  			fwts_passed(fw,
>


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Feb. 2, 2017, 4:44 a.m. UTC | #2
On 2017年01月24日 20:18, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> minor code style change, no functional difference
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/devicetree/dt_sysinfo/dt_sysinfo.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c
> index 9c22351..dd160ee 100644
> --- a/src/devicetree/dt_sysinfo/dt_sysinfo.c
> +++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c
> @@ -57,11 +57,10 @@ static int dt_sysinfo_get_version(fwts_framework *fw,
>  				char *firmware)
>  {
>  	int version_len;
> -	const char *version_buf;
>
>  	/* only output if the platform_firmware node is present */
>  	if (node >= 0) {
> -                version_buf = fdt_getprop(fw->fdt, node,
> +                const char *version_buf = fdt_getprop(fw->fdt, node,
>                          firmware, &version_len);
>                  if (version_buf) {
>                          fwts_passed(fw,
> @@ -91,7 +90,6 @@ static int dt_sysinfo_check_version(fwts_framework *fw)
>  	}
>
>  	int node, version_len;
> -	const char *version_buf;
>
>  	fwts_log_info(fw,
>  		"OPAL base device tree path is %s.",
> @@ -99,7 +97,7 @@ static int dt_sysinfo_check_version(fwts_framework *fw)
>  	node = fdt_path_offset(fw->fdt,
>  			opal_firmware);
>  	if (node >= 0) {
> -		version_buf = fdt_getprop(fw->fdt, node,
> +		const char *version_buf = fdt_getprop(fw->fdt, node,
>  			"version", &version_len);
>  		if (version_buf) {
>  			fwts_passed(fw,
>

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

Patch

diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c
index 9c22351..dd160ee 100644
--- a/src/devicetree/dt_sysinfo/dt_sysinfo.c
+++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c
@@ -57,11 +57,10 @@  static int dt_sysinfo_get_version(fwts_framework *fw,
 				char *firmware)
 {
 	int version_len;
-	const char *version_buf;
 
 	/* only output if the platform_firmware node is present */
 	if (node >= 0) {
-                version_buf = fdt_getprop(fw->fdt, node,
+                const char *version_buf = fdt_getprop(fw->fdt, node,
                         firmware, &version_len);
                 if (version_buf) {
                         fwts_passed(fw,
@@ -91,7 +90,6 @@  static int dt_sysinfo_check_version(fwts_framework *fw)
 	}
 
 	int node, version_len;
-	const char *version_buf;
 
 	fwts_log_info(fw,
 		"OPAL base device tree path is %s.",
@@ -99,7 +97,7 @@  static int dt_sysinfo_check_version(fwts_framework *fw)
 	node = fdt_path_offset(fw->fdt,
 			opal_firmware);
 	if (node >= 0) {
-		version_buf = fdt_getprop(fw->fdt, node,
+		const char *version_buf = fdt_getprop(fw->fdt, node,
 			"version", &version_len);
 		if (version_buf) {
 			fwts_passed(fw,