From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pantelis Antoniou Date: Tue, 04 Jul 2017 20:05:25 +0300 Subject: [U-Boot] [PATCH 5/5] fit: Introduce methods for applying overlays on fit-load In-Reply-To: <79bbc885-fe29-3511-05d1-cc74f9ad3bf9@denx.de> References: <1498839782-4702-1-git-send-email-pantelis.antoniou@konsulko.com> <1498839782-4702-6-git-send-email-pantelis.antoniou@konsulko.com> <79bbc885-fe29-3511-05d1-cc74f9ad3bf9@denx.de> Message-ID: <1499187925.4225.49.camel@hp800z> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Marek, On Sat, 2017-07-01 at 16:11 +0200, Marek Vasut wrote: > On 06/30/2017 06:23 PM, Pantelis Antoniou wrote: > > Introduce an overlay based method for constructing a base DT blob > > to pass to the kernel. > > > > Both canned and runtime feature selection is supported. > > > > Signed-off-by: Pantelis Antoniou > > [...] > > > @@ -1475,29 +1482,58 @@ int fit_conf_get_node(const void *fit, const char *conf_uname) > > debug("Found default configuration: '%s'\n", conf_uname); > > } > > > > + s = strchr(conf_uname, '#'); > > + if (s) { > > + len = s - conf_uname; > > + conf_uname_copy = malloc(len + 1); > > + if (!conf_uname_copy) { > > + debug("Can't allocate uname copy: '%s'\n", > > + conf_uname); > > + return -ENOMEM; > > + } > > + memcpy(conf_uname_copy, conf_uname, len); > > Is that like strdup() here ? > No. The space allocated is not the full string, just the span until the next #. > > + conf_uname_copy[len] = '\0'; > > + conf_uname = conf_uname_copy; > > + } > > + > > noffset = fdt_subnode_offset(fit, confs_noffset, conf_uname); > > if (noffset < 0) { > > debug("Can't get node offset for configuration unit name: '%s' (%s)\n", > > conf_uname, fdt_strerror(noffset)); > > } > > > > + if (conf_uname_copy) > > + free(conf_uname_copy); > > + > > return noffset; > > } > > [...] > > Regards -- Pantelis