Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: a4a86d273ff1b6f7 ("phy: phy-can-transceiver: Add support for generic CAN transceiver driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/88e158f97dd52ebaa7126cd9631f34764b9c0795.1674037334.git.geert+renesas@glider.be
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Geert Uytterhoeven and committed by
Vinod Koul
bc30c15f c63835bf

+3 -2
+3 -2
drivers/phy/phy-can-transceiver.c
··· 99 99 struct gpio_desc *standby_gpio; 100 100 struct gpio_desc *enable_gpio; 101 101 u32 max_bitrate = 0; 102 + int err; 102 103 103 104 can_transceiver_phy = devm_kzalloc(dev, sizeof(struct can_transceiver_phy), GFP_KERNEL); 104 105 if (!can_transceiver_phy) ··· 125 124 return PTR_ERR(phy); 126 125 } 127 126 128 - device_property_read_u32(dev, "max-bitrate", &max_bitrate); 129 - if (!max_bitrate) 127 + err = device_property_read_u32(dev, "max-bitrate", &max_bitrate); 128 + if ((err != -EINVAL) && !max_bitrate) 130 129 dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit\n"); 131 130 phy->attrs.max_link_rate = max_bitrate; 132 131