Re: [PATCH 3/6] libfdt: overlay: rename-fragments

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



* David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> [2018-03-19 17:42:17]:

> > +	do {
> > +		offset = fdt_next_node(fdt, offset, NULL);
> > +		if (offset < 0)
> > +			break;
> > +
> > +		name = fdt_get_name(fdt, offset, &len);
> > +		if (len > 9 && !strncmp(name, "fragment@", 9)) {
> > +			idx = name + 9;
> > +			index = strtoul(idx, &stop, 10);
> > +			if (index > max)
> > +				max = index;
> > +		}
> 
> This is wrong on multiple counts.  1) You should only check top level
> nodes, not all of them, 2) fragments aren't necessarily named
> "fragment@XX", that's just a convention - several people have
> suggested using "fragment-XX" to avoid some other problems, for
> example.  The correct way to identify fragments is to look for the
> __overlay__ subnode.  

Ok will modify to look for fragment nodes at top level that have __overlay__
node.

> 3) You have no error handling if the unit
> address doesn't parse as a decimal integer.
> 
> Come to that, I'm not sure it's ever been properly specified whether
> the number on a fragment is in decimal or not.  Usually unit names are
> in hex, but fragments are weird in a number of ways.

So no error checking on fragemnt number I guess? Just add some offset to make it
unique in the merged blob
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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