diff mbox series

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

Message ID 9bdbe83b-794b-6c6f-5ce4-fda87174bcb6@web.de (mailing list archive)
State New, archived
Headers show
Series interconnect: imx: Reduce scope for the variable “dn” in imx_icc_node_init_qos() | expand

Commit Message

Markus Elfring Dec. 6, 2020, 5:11 p.m. UTC
From: Markus Elfring <elfring@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@users.sourceforge.net>
---
 drivers/interconnect/imx/imx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
2.29.2
diff mbox series

Patch

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);