Commit cc5e92c2 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by David S. Miller
Browse files

net: stmmac: make "snps,reset-delays-us" optional again



Commit 760f1dc2 ("net: stmmac: add sanity check to
device_property_read_u32_array call") introduced error checking of the
device_property_read_u32_array() call in stmmac_mdio_reset().
This results in the following error when the "snps,reset-delays-us"
property is not defined in devicetree:
  invalid property snps,reset-delays-us

This sanity check made sense until commit 84ce4d0f ("net: stmmac:
initialize the reset delay array") ensured that there are fallback
values for the reset delay if the "snps,reset-delays-us" property is
absent. That was at the cost of making that property mandatory though.

Drop the sanity check for device_property_read_u32_array() and thus make
the "snps,reset-delays-us" property optional again (avoiding the error
message while loading the stmmac driver with a .dtb where the property
is absent).

Fixes: 760f1dc2 ("net: stmmac: add sanity check to device_property_read_u32_array call")
Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b8bd72d3
Loading
Loading
Loading
Loading
+3 −10
Original line number Original line Diff line number Diff line
@@ -242,7 +242,6 @@ int stmmac_mdio_reset(struct mii_bus *bus)
	if (priv->device->of_node) {
	if (priv->device->of_node) {
		struct gpio_desc *reset_gpio;
		struct gpio_desc *reset_gpio;
		u32 delays[3] = { 0, 0, 0 };
		u32 delays[3] = { 0, 0, 0 };
		int ret;


		reset_gpio = devm_gpiod_get_optional(priv->device,
		reset_gpio = devm_gpiod_get_optional(priv->device,
						     "snps,reset",
						     "snps,reset",
@@ -250,15 +249,9 @@ int stmmac_mdio_reset(struct mii_bus *bus)
		if (IS_ERR(reset_gpio))
		if (IS_ERR(reset_gpio))
			return PTR_ERR(reset_gpio);
			return PTR_ERR(reset_gpio);


		ret = device_property_read_u32_array(priv->device,
		device_property_read_u32_array(priv->device,
					       "snps,reset-delays-us",
					       "snps,reset-delays-us",
						     delays,
					       delays, ARRAY_SIZE(delays));
						     ARRAY_SIZE(delays));
		if (ret) {
			dev_err(ndev->dev.parent,
				"invalid property snps,reset-delays-us\n");
			return -EINVAL;
		}


		if (delays[0])
		if (delays[0])
			msleep(DIV_ROUND_UP(delays[0], 1000));
			msleep(DIV_ROUND_UP(delays[0], 1000));