* [PATCH] coresight: cti: Reduce scope for the variable “cs_fwnode” in cti_plat_create_connection()
@ 2020-12-09 20:42 Markus Elfring
2020-12-10 21:55 ` [PATCH] coresight: cti: Redu =?utf-8?Q?ce_scope_for_the_variable_=E2=80=9Ccs=5Ffwnod Mathieu Poirier
0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2020-12-09 20:42 UTC (permalink / raw)
To: coresight, linux-arm-kernel, Alexander Shishkin, Leo Yan,
Mathieu Poirier, Mike Leach, Suzuki K. Poulose
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/hwtracing/coresight/coresight-cti-platform.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
index 98f830c6ed50..ccef04f27f12 100644
--- a/drivers/hwtracing/coresight/coresight-cti-platform.c
+++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
@@ -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
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] coresight: cti: Reduce scope for the variable “cs_fwnode” in cti_plat_create_connection()
2020-12-09 20:42 [PATCH] coresight: cti: Reduce scope for the variable “cs_fwnode” in cti_plat_create_connection() Markus Elfring
2020-12-10 21:55 ` [PATCH] coresight: cti: Redu =?utf-8?Q?ce_scope_for_the_variable_=E2=80=9Ccs=5Ffwnod Mathieu Poirier
@ 2020-12-10 21:55 ` Mathieu Poirier
0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Poirier @ 2020-12-10 21:55 UTC (permalink / raw)
To: Markus Elfring
Cc: coresight, linux-arm-kernel, Alexander Shishkin, Leo Yan,
Mike Leach, Suzuki K. Poulose, LKML, kernel-janitors
On Wed, Dec 09, 2020 at 09:42:20PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/hwtracing/coresight/coresight-cti-platform.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> index 98f830c6ed50..ccef04f27f12 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> @@ -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);
I have applied your patch.
Thanks,
Mathieu
> if (!IS_ERR(cs_fwnode)) {
> assoc_name = cti_plat_get_csdev_or_node_name(cs_fwnode,
> &csdev);
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] coresight: cti: Redu =?utf-8?Q?ce_scope_for_the_variable_=E2=80=9Ccs=5Ffwnod
@ 2020-12-10 21:55 ` Mathieu Poirier
0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Poirier @ 2020-12-10 21:55 UTC (permalink / raw)
To: Markus Elfring
Cc: Suzuki K. Poulose, Alexander Shishkin, coresight,
kernel-janitors, LKML, Leo Yan, linux-arm-kernel, Mike Leach
On Wed, Dec 09, 2020 at 09:42:20PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/hwtracing/coresight/coresight-cti-platform.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> index 98f830c6ed50..ccef04f27f12 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> @@ -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);
I have applied your patch.
Thanks,
Mathieu
> if (!IS_ERR(cs_fwnode)) {
> assoc_name = cti_plat_get_csdev_or_node_name(cs_fwnode,
> &csdev);
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] coresight: cti: Reduce scope for the variable “cs_fwnode” in cti_plat_create_connection()
@ 2020-12-10 21:55 ` Mathieu Poirier
0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Poirier @ 2020-12-10 21:55 UTC (permalink / raw)
To: Markus Elfring
Cc: Suzuki K. Poulose, Alexander Shishkin, coresight,
kernel-janitors, LKML, Leo Yan, linux-arm-kernel, Mike Leach
On Wed, Dec 09, 2020 at 09:42:20PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/hwtracing/coresight/coresight-cti-platform.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> index 98f830c6ed50..ccef04f27f12 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> @@ -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);
I have applied your patch.
Thanks,
Mathieu
> 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
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-10 23:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 20:42 [PATCH] coresight: cti: Reduce scope for the variable “cs_fwnode” in cti_plat_create_connection() Markus Elfring
2020-12-10 21:55 ` Mathieu Poirier
2020-12-10 21:55 ` Mathieu Poirier
2020-12-10 21:55 ` [PATCH] coresight: cti: Redu =?utf-8?Q?ce_scope_for_the_variable_=E2=80=9Ccs=5Ffwnod Mathieu Poirier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.