提交 a78c16e1 编写于 作者: A Arnd Bergmann 提交者: David S. Miller

mdio: mux: avoid 'maybe-uninitialized' warning

The latest changes to the MDIO code introduced a false-positive
warning with gcc-6 (possibly others):

drivers/net/phy/mdio-mux.c: In function 'mdio_mux_init':
drivers/net/phy/mdio-mux.c:188:3: error: 'parent_bus_node' may be used uninitialized in this function [-Werror=maybe-uninitialized]

It's easy to avoid the warning by making sure the parent_bus_node
is initialized in both cases at the start of the function, since
the later 'of_node_put()' call is also valid for a NULL pointer
argument.
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Fixes: f20e6657 ("mdio: mux: Enhanced MDIO mux framework for integrated multiplexers")
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b06f9527
......@@ -115,6 +115,7 @@ int mdio_mux_init(struct device *dev,
goto err_parent_bus;
}
} else {
parent_bus_node = NULL;
parent_bus = mux_bus;
}
......@@ -184,8 +185,7 @@ int mdio_mux_init(struct device *dev,
put_device(&pb->mii_bus->dev);
err_parent_bus:
if (!mux_bus)
of_node_put(parent_bus_node);
of_node_put(parent_bus_node);
return ret_val;
}
EXPORT_SYMBOL_GPL(mdio_mux_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册