[PATCH] interconnect: imx: Reduce scope for the variable “dn” in imx_icc_node_init_qos()

Markus Elfring Markus.Elfring at web.de
Sun Dec 6 12:11:00 EST 2020


From: Markus Elfring <elfring at users.sourceforge.net>
Date: Sun, 6 Dec 2020 17:57:19 +0100

A local variable was used only within a single else branch.
Thus move the definition for the variable “dn” into the corresponding
code block.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring at users.sourceforge.net>
---
 drivers/interconnect/imx/imx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c
index 41dba7090c2a..6b0ac0feb4bc 100644
--- a/drivers/interconnect/imx/imx.c
+++ b/drivers/interconnect/imx/imx.c
@@ -81,7 +81,6 @@ static int imx_icc_node_init_qos(struct icc_provider *provider,
 	struct imx_icc_node *node_data = node->data;
 	const struct imx_icc_node_adj_desc *adj = node_data->desc->adj;
 	struct device *dev = provider->dev;
-	struct device_node *dn = NULL;
 	struct platform_device *pdev;

 	if (adj->main_noc) {
@@ -89,7 +88,9 @@ static int imx_icc_node_init_qos(struct icc_provider *provider,
 		dev_dbg(dev, "icc node %s[%d] is main noc itself\n",
 			node->name, node->id);
 	} else {
-		dn = of_parse_phandle(dev->of_node, adj->phandle_name, 0);
+		struct device_node *dn = of_parse_phandle(dev->of_node,
+							  adj->phandle_name,
+							  0);
 		if (!dn) {
 			dev_warn(dev, "Failed to parse %s\n",
 				 adj->phandle_name);
--
2.29.2




More information about the linux-arm-kernel mailing list