phy: can-transceiver: Drop unnecessary "mux-states" property presence check
Subsystems (2)
PATCH 1/1 phy: can-transceiver: Drop unnecessary "mux-states" property presence check
It doesn't matter whether "mux-states" is not present or there is some other issue parsing it causing an error. Drop the presence check and rework the error handling to ignore anything other than deferred probe.
---
Now a warning in v6.14-rc1, so please apply for 6.14.
v2:
- Use brackets on else clause
--- drivers/phy/phy-can-transceiver.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/phy/phy-can-transceiver.c +6 -7
@@ -103,6 +103,7 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)struct phy *phy;struct gpio_desc *standby_gpio;struct gpio_desc *enable_gpio; +struct mux_state *mux_state;u32 max_bitrate =0 ;int err;
@@ -113,13 +114,11 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) match =of_match_node (can_transceiver_phy_ids, pdev->dev.of_node); drvdata = match->data; -if (of_property_read_bool (dev->of_node,"mux-states" )) { -struct mux_state *mux_state; - - mux_state =devm_mux_state_get (dev,NULL ); -if (IS_ERR (mux_state)) -return dev_err_probe (&pdev->dev,PTR_ERR (mux_state), -"failed to get mux\n" ); + mux_state =devm_mux_state_get (dev,NULL ); +if (IS_ERR (mux_state)) { +if (PTR_ERR (mux_state) == -EPROBE_DEFER ) +return PTR_ERR (mux_state); + }else { can_transceiver_phy->mux_state = mux_state; }
Signature · 1 line
2.47.2
Quoted 5 lines · Rob Herring (Arm)
It doesn't matter whether "mux-states" is not present or there is some other issue parsing it causing an error. Drop the presence check and rework the error handling to ignore anything other than deferred probe.
Applied, thanks!
[1/1] phy: can-transceiver: Drop unnecessary "mux-states" property presence check
commit: d02dfd4ceb2e9f34caaaaf87105267e2f722f443
Best regards,
Signature · 1 line
~Vinod
Hi Rob,
Quoted 11 lines · Rob Herring (Arm)
It doesn't matter whether "mux-states" is not present or there is some other issue parsing it causing an error. Drop the presence check and rework the error handling to ignore anything other than deferred probe.
Signed-off-by Rob Herring (Arm) <[email protected]>---
Now a warning in v6.14-rc1, so please apply for 6.14.v2:
- Use brackets on else clause
Thanks for your patch, which is now commit d02dfd4ceb2e9f34 ("phy:
can-transceiver: Drop unnecessary "mux-states" property presence check") in phy/next (next-20250212 and later).
I have bisected the following error during boot on the Gray Hawk Single and White Hawk development boards:
can-transceiver-phy can-phy0: /can-phy0: failed to get mux-state (0)
Quoted 4 lines
drivers/phy/phy-can-transceiver.c +0
-0@@ -113,13 +114,11 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) match =of_match_node (can_transceiver_phy_ids, pdev->dev.of_node);
drivers/phy/phy-can-transceiver.c static int can_transceiver_phy_probe(struct platform_device *pdev) · line 117
Quoted 10 lines
drivers/phy/phy-can-transceiver.c +1
-7drvdata = match->data; -if (of_property_read_bool (dev->of_node,"mux-states" )) { -struct mux_state *mux_state; - - mux_state =devm_mux_state_get (dev,NULL ); -if (IS_ERR (mux_state)) -return dev_err_probe (&pdev->dev,PTR_ERR (mux_state), -"failed to get mux\n" ); + mux_state =devm_mux_state_get (dev,NULL );
If the (optional) "mux-states" property is not present, mux_get() prints an error message, and returns -ENOENT....
drivers/phy/phy-can-transceiver.c static int can_transceiver_phy_probe(struct platform_device *pdev) · line 120
Quoted 3 lines
drivers/phy/phy-can-transceiver.c +3
-0+if (IS_ERR (mux_state)) { +if (PTR_ERR (mux_state) == -EPROBE_DEFER ) +return PTR_ERR (mux_state);
... which is ignored here, so in the end all is good. Still, it is confusing to erroneously print an error message.
drivers/phy/phy-can-transceiver.c static int can_transceiver_phy_probe(struct platform_device *pdev) · line 123
Quoted 3 lines
drivers/phy/phy-can-transceiver.c +1
-0+ }else { can_transceiver_phy->mux_state = mux_state; }
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds