ERR_PTR pattern in phylib

Maciej W. Rozycki macro at linux-mips.org
Fri Sep 3 01:20:34 EST 2010


On Wed, 1 Sep 2010, Grant Likely wrote:

> I've been looking at the phylib code, and specifically at the use of
> the ERR_PTR() pattern.  I'm personally not a big fan of ERR_PTR()
> because the compiler cannot type check the result and it runs
> completely counter to the pattern "if (!ptr)" than is common for
> testing a pointer return value.

 Arguably using a union here would make things cleaner and any reasonable 
ABI will place small unions used as arguments or return values in 
registers, but I'm not sure if the cost of the rewrite is worth the 
benefit.  Probably not, but feel free to propose a change.

  Maciej


More information about the Linuxppc-dev mailing list