diff mbox

[U-Boot,4/8] dm: core: remove unnecessary return condition in uclass lookup

Message ID 1416212385-23800-5-git-send-email-yamada.m@jp.panasonic.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Masahiro Yamada Nov. 17, 2014, 8:19 a.m. UTC
These conditions never happen.
 - There is no real uclass with UCLASS_INVALID id.
 - uclass never becomes NULL because ll_entry_start() always returns
   a valid pointer.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 drivers/core/lists.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Simon Glass Nov. 17, 2014, 9:16 a.m. UTC | #1
On 17 November 2014 08:19, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> These conditions never happen.
>  - There is no real uclass with UCLASS_INVALID id.
>  - uclass never becomes NULL because ll_entry_start() always returns
>    a valid pointer.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Yes we now use proper error codes to detect an invalid uclass, so it
is good to clean this up.

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Nov. 23, 2014, 1 p.m. UTC | #2
On 17 November 2014 at 10:16, Simon Glass <sjg@chromium.org> wrote:
> On 17 November 2014 08:19, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
>> These conditions never happen.
>>  - There is no real uclass with UCLASS_INVALID id.
>>  - uclass never becomes NULL because ll_entry_start() always returns
>>    a valid pointer.
>>
>> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
>
> Yes we now use proper error codes to detect an invalid uclass, so it
> is good to clean this up.
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm.
diff mbox

Patch

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index 0c58ec4..ddbac38 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -41,9 +41,6 @@  struct uclass_driver *lists_uclass_lookup(enum uclass_id id)
 	const int n_ents = ll_entry_count(struct uclass_driver, uclass);
 	struct uclass_driver *entry;
 
-	if ((id == UCLASS_INVALID) || !uclass)
-		return NULL;
-
 	for (entry = uclass; entry != uclass + n_ents; entry++) {
 		if (entry->id == id)
 			return entry;