Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83aea945 authored by Andreas Schwab's avatar Andreas Schwab Committed by Benjamin Herrenschmidt
Browse files

powerpc/macio: Don't dereference pointer before null check

parent aef4b9aa
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -492,8 +492,8 @@ static void macio_pci_add_devices(struct macio_chip *chip)
	}

	/* Add media bay devices if any */
	if (mbdev) {
		pnode = mbdev->ofdev.dev.of_node;
	if (mbdev)
		for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
			if (macio_skip_device(np))
				continue;
@@ -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;