Skip to content

Commit 5b1e38c

Browse files
Robert-Ionut Alexakuba-moo
authored andcommitted
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: Robert-Ionut Alexa <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 257367c commit 5b1e38c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode)
4141
static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev,
4242
u16 dpmac_id)
4343
{
44-
struct fwnode_handle *fwnode, *parent, *child = NULL;
44+
struct fwnode_handle *fwnode, *parent = NULL, *child = NULL;
4545
struct device_node *dpmacs = NULL;
4646
int err;
4747
u32 id;
@@ -56,6 +56,9 @@ static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev,
5656
parent = fwnode;
5757
}
5858

59+
if (!parent)
60+
return NULL;
61+
5962
fwnode_for_each_child_node(parent, child) {
6063
err = -EINVAL;
6164
if (is_acpi_device_node(child))

0 commit comments

Comments
 (0)