Skip to content

Commit

Permalink
powerpc/macio: Don't dereference pointer before null check
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Schwab <[email protected]>
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
  • Loading branch information
andreas-schwab authored and ozbenh committed Jun 2, 2010
1 parent aef4b9a commit 83aea94
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/macintosh/macio_asic.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,8 @@ static void macio_pci_add_devices(struct macio_chip *chip)
}

/* Add media bay devices if any */
pnode = mbdev->ofdev.dev.of_node;
if (mbdev)
if (mbdev) {
pnode = mbdev->ofdev.dev.of_node;
for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
if (macio_skip_device(np))
continue;
Expand All @@ -502,10 +502,11 @@ static void macio_pci_add_devices(struct macio_chip *chip)
mbdev, root_res) == NULL)
of_node_put(np);
}
}

/* Add serial ports if any */
pnode = sdev->ofdev.dev.of_node;
if (sdev) {
pnode = sdev->ofdev.dev.of_node;
for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
if (macio_skip_device(np))
continue;
Expand Down

0 comments on commit 83aea94

Please sign in to comment.