From patchwork Thu Mar 6 12:42:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 14004432 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5389D190051; Thu, 6 Mar 2025 12:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741265000; cv=none; b=J7tP3FZr0qSnQIKk3zTN7vp5mJZJBdt/FN8hEwjBz4h0qleVtCSxlZyzyl/o2jRN8/BYdgmJau74/CTYdZ0zGxxpdVT0WY+Ivz3LNVvLd0xmB/Ovb7IFijYMaO6oFSAbTgTn61kCUpnXqdLvGV/HCk+YHijmA993RXlVaXL1r8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741265000; c=relaxed/simple; bh=f6uFof6SyNFkJU1P45UAyllVaMxXt68tkS7/hZn5qsc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u/zF34KkJt/7CF9g7HFjD4c9ZSeJA6UJewkOKPTZsWmIN8KbCzUVeyA8+EKFw8DTuBsUUq0PaaezZQ2Qk3brF5wb2KALDR4K+g+5gK+IQlzGfxuOcG1NaZI55tlDzwqlavee77L/KMrMIcNemZ0ctDmIrY3oy+I0TcjiGnpAvLQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: Jl9jmP9CTz6RGjR5lJpBoA== X-CSE-MsgGUID: 9oeTNwGSR02aQodyO7eFUg== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 06 Mar 2025 21:43:18 +0900 Received: from localhost.localdomain (unknown [10.226.92.10]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A38E94281B03; Thu, 6 Mar 2025 21:43:14 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol Cc: Biju Das , Geert Uytterhoeven , Wolfram Sang , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Rob Herring , Ulrich Hecht , linux-can@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v4 03/11] can: rcar_canfd: Use of_get_available_child_by_name() Date: Thu, 6 Mar 2025 12:42:42 +0000 Message-ID: <20250306124256.93033-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250306124256.93033-1-biju.das.jz@bp.renesas.com> References: <20250306124256.93033-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Geert Uytterhoeven Signed-off-by: Biju Das --- v3->v4: * No change. v2->v3: * Added Rb tag from Geert. v2: * Added to this series as dependency patch hit on can-next. * Added Rb tag from Vincent Mailhol * Dropped redundant comment from commit description. --- drivers/net/can/rcar/rcar_canfd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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]); }