diff mbox

opal: cpu_info: remove redundant initialization of prop_string to NULL

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

Commit Message

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

prop_string is initialized to NULL and then re-assigned immediately
afterwards.  Remove the redundant initialization.

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

Comments

Alex Hung Jan. 25, 2017, 7:21 a.m. UTC | #1
On 2017-01-24 08:29 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> prop_string is initialized to NULL and then re-assigned immediately
> afterwards.  Remove the redundant initialization.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/opal/cpu_info.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c
> index 1d5ec3c..22cccbf 100644
> --- a/src/opal/cpu_info.c
> +++ b/src/opal/cpu_info.c
> @@ -34,9 +34,8 @@ static int get_xscom_property(fwts_framework *fw,
>  {
>  	int node, prop_len, failures = 0;
>  	const char *prop_buf;
> -	char *prop_string = NULL;
> +	char *prop_string = strstr(my_path, "/xscom");
>
> -	prop_string = strstr(my_path, "/xscom");
>  	if (prop_string) {
>  		node = fdt_path_offset(fw->fdt, prop_string);
>  		if (node >= 0) {
>


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Feb. 2, 2017, 4:50 a.m. UTC | #2
On 2017年01月24日 20:29, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> prop_string is initialized to NULL and then re-assigned immediately
> afterwards.  Remove the redundant initialization.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/opal/cpu_info.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c
> index 1d5ec3c..22cccbf 100644
> --- a/src/opal/cpu_info.c
> +++ b/src/opal/cpu_info.c
> @@ -34,9 +34,8 @@ static int get_xscom_property(fwts_framework *fw,
>  {
>  	int node, prop_len, failures = 0;
>  	const char *prop_buf;
> -	char *prop_string = NULL;
> +	char *prop_string = strstr(my_path, "/xscom");
>
> -	prop_string = strstr(my_path, "/xscom");
>  	if (prop_string) {
>  		node = fdt_path_offset(fw->fdt, prop_string);
>  		if (node >= 0) {
>

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

Patch

diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c
index 1d5ec3c..22cccbf 100644
--- a/src/opal/cpu_info.c
+++ b/src/opal/cpu_info.c
@@ -34,9 +34,8 @@  static int get_xscom_property(fwts_framework *fw,
 {
 	int node, prop_len, failures = 0;
 	const char *prop_buf;
-	char *prop_string = NULL;
+	char *prop_string = strstr(my_path, "/xscom");
 
-	prop_string = strstr(my_path, "/xscom");
 	if (prop_string) {
 		node = fdt_path_offset(fw->fdt, prop_string);
 		if (node >= 0) {