diff mbox

[U-Boot,2/4] dm: do not check the existence of uclass operation

Message ID 1411912347-13642-3-git-send-email-yamada.m@jp.panasonic.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Masahiro Yamada Sept. 28, 2014, 1:52 p.m. UTC
The function uclass_add() checks uc_drv->ops as follows:

        if (uc_drv->ops) {
                dm_warn("No ops for uclass id %d\n", id);
                return -EINVAL;
        }

It seems odd because it warns "No ops" when uc_drv->ops has
non-NULL pointer.  (Looks opposite.)

Anyway, most of UCLASS_DRIVER entries have no .ops member.
This check makes no sense.

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

 drivers/core/uclass.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Simon Glass Sept. 28, 2014, 3:15 p.m. UTC | #1
On 28 September 2014 07:52, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> The function uclass_add() checks uc_drv->ops as follows:
>
>         if (uc_drv->ops) {
>                 dm_warn("No ops for uclass id %d\n", id);
>                 return -EINVAL;
>         }
>
> It seems odd because it warns "No ops" when uc_drv->ops has
> non-NULL pointer.  (Looks opposite.)
>
> Anyway, most of UCLASS_DRIVER entries have no .ops member.
> This check makes no sense.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Oct. 10, 2014, 2:41 a.m. UTC | #2
On 28 September 2014 09:15, Simon Glass <sjg@chromium.org> wrote:
> On 28 September 2014 07:52, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
>> The function uclass_add() checks uc_drv->ops as follows:
>>
>>         if (uc_drv->ops) {
>>                 dm_warn("No ops for uclass id %d\n", id);
>>                 return -EINVAL;
>>         }
>>
>> It seems odd because it warns "No ops" when uc_drv->ops has
>> non-NULL pointer.  (Looks opposite.)
>>
>> Anyway, most of UCLASS_DRIVER entries have no .ops member.
>> This check makes no sense.
>>
>> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!
diff mbox

Patch

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 61ca17e..901b06e 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -60,10 +60,6 @@  static int uclass_add(enum uclass_id id, struct uclass **ucp)
 			id);
 		return -ENOENT;
 	}
-	if (uc_drv->ops) {
-		dm_warn("No ops for uclass id %d\n", id);
-		return -EINVAL;
-	}
 	uc = calloc(1, sizeof(*uc));
 	if (!uc)
 		return -ENOMEM;