Dear Nobuhiro Iwamatsu,

In message <[email protected]> you 
wrote:
>
> >>               dev = (struct eth_device *)malloc(sizeof *> dev);
> >> +             memset(dev, 0, sizeof(*dev));
> >>
> >>               sprintf (dev->name, "RTL8139#%d", card_numbe> r);
> >
> > Apparently its quite common NOT to check malloc()'s possible
> > NULL return value... At least most NET drivers don't seem to...
>
> Oh, This is a stupid mistake.

I just want to point out that this was not your mistake!

The existing code did not check the return code either.

So actually you fixed a bug, while Reinhard noticed another,
unrelated bug.


> I think that a function such as kzalloc of the linux kernel is convenient.

Yes, but it needs careful consideration about how to handle malloc()
errors. It may not always be appropriate to crash the whole system.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
"I go on working for the same reason a hen goes on laying eggs."
- H. L. Mencken
_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to