Commit 5b1e38c0 authored by Robert-Ionut Alexa's avatar Robert-Ionut Alexa Committed by Jakub Kicinski

dpaa2-mac: bail if the dpmacs fwnode is not found

The parent pointer node handler must be declared with a NULL
initializer. Before using it, a check must be performed to make
sure that a valid address has been assigned to it.
Signed-off-by: default avatarRobert-Ionut Alexa <robert-ionut.alexa@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 257367c0
...@@ -41,7 +41,7 @@ static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode) ...@@ -41,7 +41,7 @@ static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode)
static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev, static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev,
u16 dpmac_id) u16 dpmac_id)
{ {
struct fwnode_handle *fwnode, *parent, *child = NULL; struct fwnode_handle *fwnode, *parent = NULL, *child = NULL;
struct device_node *dpmacs = NULL; struct device_node *dpmacs = NULL;
int err; int err;
u32 id; u32 id;
...@@ -56,6 +56,9 @@ static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev, ...@@ -56,6 +56,9 @@ static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev,
parent = fwnode; parent = fwnode;
} }
if (!parent)
return NULL;
fwnode_for_each_child_node(parent, child) { fwnode_for_each_child_node(parent, child) {
err = -EINVAL; err = -EINVAL;
if (is_acpi_device_node(child)) if (is_acpi_device_node(child))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment