Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Gu <ustc.gu@gmail.com>
To: Vinod Koul <vkoul@kernel.org>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	 Geert Uytterhoeven <geert+renesas@glider.be>,
	 Magnus Damm <magnus.damm@gmail.com>,
	Ulrich Hecht <uli+renesas@fpond.eu>,
	 Wolfram Sang <wsa+renesas@sang-engineering.com>,
	 Biju Das <biju.das@bp.renesas.com>,
	 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Kishon Vijay Abraham I <kishon@kernel.org>,
	 linux-phy@lists.infradead.org,
	linux-renesas-soc@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH] phy: renesas: rcar-gen2: Return -EINVAL for out-of-range channel reg
Date: Mon, 03 Aug 2026 21:07:27 +0800	[thread overview]
Message-ID: <20260803-rcar-gen2-1-v1-1-4796ea6e76d8@gmail.com> (raw)

When of_property_read_u32() succeeds but channel_num exceeds
data->num_channels, rcar_gen2_phy_probe() returns error which is 0,
so probe reports success even though no PHY provider is registered.

Return -EINVAL in that case.

Fixes: 1233f59f745b ("phy: Renesas R-Car Gen2 PHY driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/phy/renesas/phy-rcar-gen2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/renesas/phy-rcar-gen2.c b/drivers/phy/renesas/phy-rcar-gen2.c
index 6c671254c625..f0858d8cc705 100644
--- a/drivers/phy/renesas/phy-rcar-gen2.c
+++ b/drivers/phy/renesas/phy-rcar-gen2.c
@@ -390,7 +390,7 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
 		error = of_property_read_u32(np, "reg", &channel_num);
 		if (error || channel_num >= data->num_channels) {
 			dev_err(dev, "Invalid \"reg\" property\n");
-			return error;
+			return error ?: -EINVAL;
 		}
 		channel->select_mask = select_mask[channel_num];
 

---
base-commit: 415606a7be939835db9b0d6b711887586646346d
change-id: 20260803-rcar-gen2-1-98f440b28b35

Best regards,
--  
Felix Gu <ustc.gu@gmail.com>


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

             reply	other threads:[~2026-08-03 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 13:07 Felix Gu [this message]
2026-08-03 13:18 ` [PATCH] phy: renesas: rcar-gen2: Return -EINVAL for out-of-range channel reg sashiko-bot
2026-08-03 13:26 ` Biju Das
2026-08-04 14:39   ` Felix Gu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260803-rcar-gen2-1-v1-1-4796ea6e76d8@gmail.com \
    --to=ustc.gu@gmail.com \
    --cc=biju.das@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=kishon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=uli+renesas@fpond.eu \
    --cc=vkoul@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox