Message ID | 20250220130427.217342-4-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | Add support for RZ/G3E CANFD | expand |
On Thu, 20 Feb 2025 at 14:04, Biju Das <biju.das.jz@bp.renesas.com> wrote: > 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: Vincent Mailhol <mailhol.vincent@wanadoo.fr> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > --- > v2: > * Added to this series as dependency patch hit on can-next. > * Added Rb tag from Vincent Mailhol > * Dropped redundant comment from commit description. Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Gr{oetje,eeting}s, Geert
diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index 270f50d836f5..8b326977ddf7 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1864,13 +1864,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); } - of_node_put(of_child); if (IS_ERR(transceivers[i])) return PTR_ERR(transceivers[i]); }