Commit bc30c15f authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Vinod Koul

phy: phy-can-transceiver: Skip warning if no "max-bitrate"

According to the DT bindings, the "max-bitrate" property is optional.
However, when it is not present, a warning is printed.
Fix this by adding a missing check for -EINVAL.

Fixes: a4a86d27 ("phy: phy-can-transceiver: Add support for generic CAN transceiver driver")
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/88e158f97dd52ebaa7126cd9631f34764b9c0795.1674037334.git.geert+renesas@glider.beSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent c63835bf
...@@ -99,6 +99,7 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) ...@@ -99,6 +99,7 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
struct gpio_desc *standby_gpio; struct gpio_desc *standby_gpio;
struct gpio_desc *enable_gpio; struct gpio_desc *enable_gpio;
u32 max_bitrate = 0; u32 max_bitrate = 0;
int err;
can_transceiver_phy = devm_kzalloc(dev, sizeof(struct can_transceiver_phy), GFP_KERNEL); can_transceiver_phy = devm_kzalloc(dev, sizeof(struct can_transceiver_phy), GFP_KERNEL);
if (!can_transceiver_phy) if (!can_transceiver_phy)
...@@ -124,8 +125,8 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) ...@@ -124,8 +125,8 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
return PTR_ERR(phy); return PTR_ERR(phy);
} }
device_property_read_u32(dev, "max-bitrate", &max_bitrate); err = device_property_read_u32(dev, "max-bitrate", &max_bitrate);
if (!max_bitrate) if ((err != -EINVAL) && !max_bitrate)
dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit\n"); dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit\n");
phy->attrs.max_link_rate = max_bitrate; phy->attrs.max_link_rate = max_bitrate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment