Commit 56f3dc3e authored by Biju Das's avatar Biju Das Committed by Marc Kleine-Budde
Browse files

can: rcar_canfd: Use of_get_available_child_by_name()



Simplify rcar_canfd_probe() using of_get_available_child_by_name().

While at it, move of_node_put(child) inside the if block to avoid
additional check if of_child is NULL.

Reviewed-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20250417054320.14100-4-biju.das.jz@bp.renesas.com


Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent e623c6e5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1855,13 +1855,13 @@ static int rcar_canfd_probe(struct platform_device *pdev)

	for (i = 0; i < info->max_channels; ++i) {
		name[7] = '0' + i;
		of_child = of_get_child_by_name(dev->of_node, name);
		if (of_child && of_device_is_available(of_child)) {
		of_child = of_get_available_child_by_name(dev->of_node, name);
		if (of_child) {
			channels_mask |= BIT(i);
			transceivers[i] = devm_of_phy_optional_get(dev,
							of_child, NULL);
		}
			of_node_put(of_child);
		}
		if (IS_ERR(transceivers[i]))
			return PTR_ERR(transceivers[i]);
	}