[U-Boot] [PATCH] [v2] tsec: fix the return value for tsec_eth_init() and tsec_standard_init()
Mike Frysinger
vapier at gentoo.org
Tue Jun 8 06:04:04 CEST 2010
On Monday, June 07, 2010 18:55:18 Timur Tabi wrote:
> Mike Frysinger wrote:
> > On Monday, June 07, 2010 14:31:27 Timur Tabi wrote:
> >> In general, if an function initializes only one device, then it should
> >> return a negative number if there's an error. If it initializes more
> >> than one device, then it should never return a negative number. This
> >> is why these functions now return an unsigned integer.
> >
> > i dont think this is a good idea. either the init funcs should all be
> > converted to unsigned int, or they should stay int. doing it piecemeal
> > leads to confusion with zero upside.
>
> I don't want to change all of the functions. For most devices, there's no
> way I can test them.
i dont think this is a big deal. plenty of tree wide changes are made and
people try their best to break things without actually testing them.
> Just because pci_eth_int() is incorrect, that doesn't mean that I can't
> make tsec_eth_init() correct.
except all the documentation and existing code says "use int", so "correct" is
in the eye of the beholder here. i think consistency is more important at
this point than an otherwise meaningless value.
> > your fixes no way require these to be unsigned int funcs.
>
> What's the point of making the return value a signed integer if it can
> never be a negative number? The reason I changed the type to unsigned int
> is to make it very clear that it will never return an error code.
the documentation currently states that a negative value is permissible and
thus "int" is correct. as for the code that actually reads the result, that
is by & large common code, so logic along those lines isnt terribly important.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100608/73dba230/attachment.pgp
More information about the U-Boot
mailing list