On 2/5/21 6:06 AM, Pratyush Yadav wrote:
On 04/02/21 11:39PM, Sean Anderson wrote:
idle-states is optional, so don't complain if it doesn't exist.

This commit doesn't just silence the complaint. It also changes the
behavior of the function if the error code is ENODATA or EOVERFLOW. Make
sure the commit message reflects that.

Sure.



Signed-off-by: Sean Anderson <sean...@gmail.com>
---

  drivers/mux/mmio.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
index 00e0282dcc..82b1cc6aab 100644
--- a/drivers/mux/mmio.c
+++ b/drivers/mux/mmio.c
@@ -87,8 +87,11 @@ static int mmio_mux_probe(struct udevice *dev)
ret = dev_read_u32_array(dev, "idle-states", idle_states, num_fields);
        if (ret < 0) {
-               log_err("idle-states");
                devm_kfree(dev, idle_states);
+               /* dev_read_u32_array returns -EINVAL on missing property */
+               if (ret != -EINVAL)
+                       return log_msg_ret("idle-states", -EINVAL);

Return ret here. I don't see any reason to return -EINVAL when the error
is _not_ -EINVAL.

EINVAL is the traditional return value for when a binding is malformed.
Though I don't mind returning ENODATA or EOVERFLOW here. Will be
updated.

--Sean


+
                idle_states = NULL;
        }
--
2.29.2



Reply via email to