From patchwork Thu Feb 20 13:04:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13983906 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 0914D1F76B5; Thu, 20 Feb 2025 13:04:49 +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=1740056691; cv=none; b=F6RiJGZVQsmF3FvV1sWj7ztkhxHdJgFigkeH9dG5CYyNWhCkIQdKMY4iLcMmHyfScrd88k+hnuY4+0QRifmXDJfEncXqhrkk79cakiZU3IzIgoP+7QPAzOH3i/jFvRLOLu8VSTk2DnegXPsvs989fLCWM1sqPUXuKwVyX8i7wTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056691; c=relaxed/simple; bh=UwE+9lXUEKVKM4ln1rjdsdjoJ4UkrJerFYIMjw4N1Ps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SxGtVjv4mWiE0V007sIAF8sj3B3j8AMO7a7N+bFk13uAKlpZOlZ1uwAKewvKIrukbCGRN9T8D/WLdSMcIjFL+jqf9oU9fmDfHo3B0aEuB70KaQD9bM2GYL5oU2YTFmL83weE+mXiJ+oTZFnomnhrtYCqyfEXJInpMz9LgYq2x5M= 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: 9rCZ/zr3S22XougzjTGRig== X-CSE-MsgGUID: zSt89Nl7S8ySxizgwZAoBA== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 20 Feb 2025 22:04:49 +0900 Received: from localhost.localdomain (unknown [10.226.92.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 3AC3342B36D6; Thu, 20 Feb 2025 22:04:45 +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 v2 3/7] can: rcar_canfd: Use of_get_available_child_by_name() Date: Thu, 20 Feb 2025 13:04:19 +0000 Message-ID: <20250220130427.217342-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> References: <20250220130427.217342-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 Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- 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]); }