Commit ff114b66 authored by Remi Machet's avatar Remi Machet Committed by Paul Mackerras
Browse files

[POWERPC] Initialize all mv64x60 devices even if one fails



If one of the devices of the mv64x60 init fails, the remaining
devices are not initialized.

This changes the code to display an error and continue the
initialization.

Signed-off-by: default avatarRemi Machet <(rmachet@slac.stanford.edu)>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 21dbfd29
Loading
Loading
Loading
Loading
+26 −16
Original line number Original line Diff line number Diff line
@@ -431,9 +431,13 @@ static int __init mv64x60_device_setup(void)
	int err;
	int err;


	id = 0;
	id = 0;
	for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc")
	for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc") {
		if ((err = mv64x60_mpsc_device_setup(np, id++)))
		err = mv64x60_mpsc_device_setup(np, id++);
			goto error;
		if (err)
			printk(KERN_ERR "Failed to initialize MV64x60 "
					"serial device %s: error %d.\n",
					np->full_name, err);
	}


	id = 0;
	id = 0;
	id2 = 0;
	id2 = 0;
@@ -441,38 +445,44 @@ static int __init mv64x60_device_setup(void)
		pdev = mv64x60_eth_register_shared_pdev(np, id++);
		pdev = mv64x60_eth_register_shared_pdev(np, id++);
		if (IS_ERR(pdev)) {
		if (IS_ERR(pdev)) {
			err = PTR_ERR(pdev);
			err = PTR_ERR(pdev);
			goto error;
			printk(KERN_ERR "Failed to initialize MV64x60 "
					"network block %s: error %d.\n",
					np->full_name, err);
			continue;
		}
		}
		for_each_child_of_node(np, np2) {
		for_each_child_of_node(np, np2) {
			if (!of_device_is_compatible(np2,
			if (!of_device_is_compatible(np2,
					"marvell,mv64360-eth"))
					"marvell,mv64360-eth"))
				continue;
				continue;
			err = mv64x60_eth_device_setup(np2, id2++, pdev);
			err = mv64x60_eth_device_setup(np2, id2++, pdev);
			if (err) {
			if (err)
				of_node_put(np2);
				printk(KERN_ERR "Failed to initialize "
				goto error;
						"MV64x60 network device %s: "
			}
						"error %d.\n",
						np2->full_name, err);
		}
		}
	}
	}


	id = 0;
	id = 0;
	for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c")
	for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c") {
		if ((err = mv64x60_i2c_device_setup(np, id++)))
		err = mv64x60_i2c_device_setup(np, id++);
			goto error;
		if (err)
			printk(KERN_ERR "Failed to initialize MV64x60 I2C "
					"bus %s: error %d.\n",
					np->full_name, err);
	}


	/* support up to one watchdog timer */
	/* support up to one watchdog timer */
	np = of_find_compatible_node(np, NULL, "marvell,mv64360-wdt");
	np = of_find_compatible_node(np, NULL, "marvell,mv64360-wdt");
	if (np) {
	if (np) {
		if ((err = mv64x60_wdt_device_setup(np, id)))
		if ((err = mv64x60_wdt_device_setup(np, id)))
			goto error;
			printk(KERN_ERR "Failed to initialize MV64x60 "
					"Watchdog %s: error %d.\n",
					np->full_name, err);
		of_node_put(np);
		of_node_put(np);
	}
	}


	return 0;
	return 0;

error:
	of_node_put(np);
	return err;
}
}
arch_initcall(mv64x60_device_setup);
arch_initcall(mv64x60_device_setup);