Re: [PATCH v4 1/3] libfdt: Add new maximum phandle lookup function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, Mar 29, 2019 at 01:32:55PM +1100, David Gibson wrote:
> On Tue, Mar 26, 2019 at 04:33:00PM +0100, Thierry Reding wrote:
> > From: Thierry Reding <treding@xxxxxxxxxx>
> > 
> > The fdt_get_max_phandle() function has some shortcomings. On one hand it
> > returns a uint32_t phandle value via a signed return value.
> 
> Uh.. no it doesn't..

Ugh... I got that backwards. It's actually returning a signed error code
via an unsigned return value.

> 
> > This means a
> > caller has to explicitly cast the return value to a uint32_t and perform
> > explicit checks against the error code (uint32_t)-1. In addition, the -1
> > is the only error code that can be returned, so a caller cannot tell the
> > difference between the various failures.
> > 
> > Fix this by adding a new fdt_find_max_phandle() function that returns an
> > error code on failure and 0 on success, just like other APIs, and stores
> > the maximum phandle value in an output argument on success.
> > 
> > This also refactors fdt_get_max_phandle() to use the new function. Add a
> > note pointing out that the new fdt_find_max_phandle() function should be
> > preferred over fdt_get_max_phandle().
> > 
> > Signed-off-by: Thierry Reding <treding@xxxxxxxxxx>
> 
> I've applied the series, but adjusted the commit message above for
> accuracy.  I'm also planning on some followup cleanups which may
> change things up a bit more.

Thanks. Please do add me on Cc if you want me to review any followup
patches to this.

Thierry

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux