Re: [PATCH v3] Add limited read-only support for older (V2 and V3) device tree to libfdt.

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



On Fri, Jan 19, 2018 at 09:48:03PM +0000, nwhitehorn@xxxxxxxxxxx wrote:
> From: Nathan Whitehorn <nwhitehorn@xxxxxxxxxxx>
> 
> This can be useful in particular in the kernel when booting on systems
> with FDT-emitting firmware that is out of date. Releases of kexec-tools
> on ppc64 prior to the end of 2014 are notable examples of such.
> 
> Signed-off-by: Nathan Whitehorn <nwhitehorn@xxxxxxxxxxx>
> ---
> 
> This version of the patch fixes a number of style issues and removes some
> unnecessary redundant code noted in review.

As suggested, please implement the change to use
fdt_get_property_namelen_() in fdt_getprop_namelen().  Plus I spotted
one other bug..

[snip]
> +	if (fdt_version(fdt) < 0x10) {
> +		/*
> +		 * For old FDT versions, match the naming conventions of V16:
> +		 * give only the leaf name (after all /). The actual tree
> +		 * contents are loosely checked.
> +		 */
> +		const char *leaf;
> +		leaf = strrchr(nameptr, '/');
> +		if (leaf == NULL) {
> +			err = FDT_ERR_BADVALUE;

The error codes are defined positive, but used negative, so this needs
to be err = -FDT_ERR_BADVAULE,  Except, actually, I think BADSTRUCTURE
would be a better option.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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