From patchwork Tue Feb 25 15:40: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: 13990129 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 0588116A95B; Tue, 25 Feb 2025 15:41:19 +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=1740498081; cv=none; b=s+pP3HKfvHiTTCM7WQaLMc1ucOMBmOMQj55hCwOex8Nqp6xmxOzYM4JPSUFm7L25f8rhgcqsdh+TXYq/2J15NVHQgaNRikMNvAWIZTpLBClshhMufOMWLbjGJ+KPnAW/2jJdL7h9JwXnwsQsnwBUrfco05nMLUeiWmpGwLpz7g4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740498081; c=relaxed/simple; bh=+7tNd4WxD+HBtnQQ2aRNddDItnR5VLWVgrBdZxC37DU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E8a97G2X2YcdLeAKtsdbCg4avI+2rvtH6mnVpODipqs6peVyegbcHVVR3HKIsdejZ7qQq6FEst8LjOynW9ysXPQ6yqtaxjAiEft1xfwFN0ABIEKcj5LAT4jU/ZvwwI6Rdx/1vvWnGzthKcVtLjVhdFen8kb1HRQIQH36aHu7kao= 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: l0U6VSQZQ/ai4WEDapn2Jg== X-CSE-MsgGUID: SMkICqfVRGW/+LQ0NP17qQ== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 26 Feb 2025 00:41:19 +0900 Received: from localhost.localdomain (unknown [10.226.92.81]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 4F256400FFC0; Wed, 26 Feb 2025 00:41:16 +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 v3 03/11] can: rcar_canfd: Use of_get_available_child_by_name() Date: Tue, 25 Feb 2025 15:40:42 +0000 Message-ID: <20250225154058.59116-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250225154058.59116-1-biju.das.jz@bp.renesas.com> References: <20250225154058.59116-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 --- 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]); }