coresight: cti: Reduce scope for the variable “cs_fwnode” in cti_plat_create_connection()
PATCH 1/1 coresight: cti: Reduce scope for the variable “cs_fwnode” in cti_plat_create_connection()
From: Markus Elfring <[email protected]>
Date: Wed, 9 Dec 2020 21:34:48 +0100
A local variable was used only within an else branch. Thus move the definition for the variable “cs_fwnode” into the corresponding code block.
This issue was detected by using the Coccinelle software.
--- drivers/hwtracing/coresight/coresight-cti-platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-cti-platform.c +3 -3
@@ -343,7 +343,6 @@ static int cti_plat_create_connection(struct device *dev, {struct cti_trig_con *tc =NULL ;int cpuid =-1 , err =0 ; -struct fwnode_handle *cs_fwnode =NULL ;struct coresight_device *csdev =NULL ;const char *assoc_name ="unknown" ;char cpu_name_str[16 ];
@@ -397,8 +396,9 @@ static int cti_plat_create_connection(struct device *dev, assoc_name = cpu_name_str; }else {/* associated device ? */ - cs_fwnode =fwnode_find_reference (fwnode, -CTI_DT_CSDEV_ASSOC ,0 ); +struct fwnode_handle *cs_fwnode =fwnode_find_reference (fwnode, +CTI_DT_CSDEV_ASSOC , +0 );if (!IS_ERR (cs_fwnode)) { assoc_name =cti_plat_get_csdev_or_node_name (cs_fwnode, &csdev);
--
2.29.2
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 27 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 9 Dec 2020 21:34:48 +0100A local variable was used only within an else branch. Thus move the definition for the variable “cs_fwnode” into the corresponding code block.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/hwtracing/coresight/coresight-cti-platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-cti-platform.c +0
-1@@ -343,7 +343,6 @@ static int cti_plat_create_connection(struct device *dev, {struct cti_trig_con *tc =NULL ;int cpuid =-1 , err =0 ; -struct fwnode_handle *cs_fwnode =NULL ;struct coresight_device *csdev =NULL ;const char *assoc_name ="unknown" ;char cpu_name_str[16 ];
drivers/hwtracing/coresight/coresight-cti-platform.c static int cti_plat_create_connection(struct device *dev, · line 401
Quoted 8 lines
drivers/hwtracing/coresight/coresight-cti-platform.c +3
-2@@ -397,8 +396,9 @@ static int cti_plat_create_connection(struct device *dev, assoc_name = cpu_name_str; }else {/* associated device ? */ - cs_fwnode =fwnode_find_reference (fwnode, -CTI_DT_CSDEV_ASSOC ,0 ); +struct fwnode_handle *cs_fwnode =fwnode_find_reference (fwnode, +CTI_DT_CSDEV_ASSOC , +0 );
I have applied your patch.
Thanks,
Mathieu
Quoted 6 lines
drivers/hwtracing/coresight/coresight-cti-platform.c +0
-1if (!IS_ERR (cs_fwnode)) { assoc_name =cti_plat_get_csdev_or_node_name (cs_fwnode, &csdev); --2.29.2