All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Ziswiler <marcel@ziswiler.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] dm: device: fail uclass_find_first_device() if list_empty
Date: Thu, 24 Jan 2019 15:29:55 +0100	[thread overview]
Message-ID: <20190124142957.15040-2-marcel@ziswiler.com> (raw)
In-Reply-To: <20190124142957.15040-1-marcel@ziswiler.com>

From: Marcel Ziswiler <marcel.ziswiler@toradex.com>

While uclass_find_device() fails with -ENODEV in case of list_empty
strangely uclass_find_first_device() returns 0.

Fix uclass_find_first_device() to also fail with -ENODEV instead.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

---

 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index a622f07941..fc3157de39 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -225,7 +225,7 @@ int uclass_find_first_device(enum uclass_id id, struct udevice **devp)
 	if (ret)
 		return ret;
 	if (list_empty(&uc->dev_head))
-		return 0;
+		return -ENODEV;
 
 	*devp = list_first_entry(&uc->dev_head, struct udevice, uclass_node);
 
-- 
2.20.1

  reply	other threads:[~2019-01-24 14:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 14:29 [U-Boot] [PATCH 0/3] While converting SATA on Apalis iMX6 to use driver model I noticed it Marcel Ziswiler
2019-01-24 14:29 ` Marcel Ziswiler [this message]
2019-01-24 20:18   ` [U-Boot] [PATCH 1/3] dm: device: fail uclass_find_first_device() if list_empty Simon Glass
2019-01-25 11:23     ` Marcel Ziswiler
2019-01-24 14:29 ` [U-Boot] [PATCH 2/3] dm: sata: add null pointer check for dev Marcel Ziswiler
2019-01-24 20:18   ` Simon Glass
2019-01-25 11:28     ` Marcel Ziswiler
2019-01-24 14:29 ` [U-Boot] [PATCH 3/3] cmd: " Marcel Ziswiler
2019-01-24 20:18   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190124142957.15040-2-marcel@ziswiler.com \
    --to=marcel@ziswiler.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.