diff mbox series

[v4,03/12] PCI: of: Zero max-link-speed value is invalid

Message ID 20200430080625.26070-4-pali@kernel.org
State New
Headers show
Series PCI: aardvark: Fix support for Turris MOX and Compex wifi cards | expand

Commit Message

Pali Rohár April 30, 2020, 8:06 a.m. UTC
Interpret zero value of max-link-speed property as invalid,
as the device tree bindings documentation specifies.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rob Herring May 7, 2020, 9:07 p.m. UTC | #1
On Thu, 30 Apr 2020 10:06:16 +0200, =?UTF-8?q?Pali=20Roh=C3=A1r?= wrote:
> Interpret zero value of max-link-speed property as invalid,
> as the device tree bindings documentation specifies.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/pci/of.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>
diff mbox series

Patch

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index 81ceeaa6f1d5..27839cd2459f 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -592,7 +592,7 @@  int of_pci_get_max_link_speed(struct device_node *node)
 	u32 max_link_speed;
 
 	if (of_property_read_u32(node, "max-link-speed", &max_link_speed) ||
-	    max_link_speed > 4)
+	    max_link_speed == 0 || max_link_speed > 4)
 		return -EINVAL;
 
 	return max_link_speed;