From: Chris Packham <Chris.Packham@alliedtelesis.co.nz> To: Rob Herring <robh@kernel.org>, Russell King <linux@armlinux.org.uk> Cc: "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, Qi Zheng <arch0.zheng@gmail.com> Subject: Re: [PATCH] ARM: zImage: atags_to_fdt: Fix node names on added root nodes Date: Tue, 26 Jan 2021 02:50:12 +0000 [thread overview] Message-ID: <329a3043-a85f-8177-c3ad-a9c07604a266@alliedtelesis.co.nz> (raw) In-Reply-To: <20210126023905.1631161-1-robh@kernel.org> Hi Rob, On 26/01/21 3:39 pm, Rob Herring wrote: > Commit 7536c7e03e74 ("of/fdt: Remove redundant kbasename function > call") exposed a bug creating DT nodes in the ATAGS to DT fixup code. > Non-existent nodes would mistaken get created with a leading '/'. The > problem was fdt_path_offset() takes a full path while creating a node > with fdt_add_subnode() takes just the basename. > > Since this we only add root child nodes, we can just skip over the '/'. > > Fixes: 7536c7e03e74 ("of/fdt: Remove redundant kbasename function call") > Reported-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > Cc: Qi Zheng <arch0.zheng@gmail.com> > Cc: Russell King <linux@armlinux.org.uk> > Signed-off-by: Rob Herring <robh@kernel.org> Thanks for the quick patch. It doesn't quite seem to work as my system can't find it's initrd (it can with my other hacky patch). It does seem to get the command line info as I'm getting printk output. > --- > arch/arm/boot/compressed/atags_to_fdt.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c > index 8452753efebe..31927d2fe297 100644 > --- a/arch/arm/boot/compressed/atags_to_fdt.c > +++ b/arch/arm/boot/compressed/atags_to_fdt.c > @@ -15,7 +15,8 @@ static int node_offset(void *fdt, const char *node_path) > { > int offset = fdt_path_offset(fdt, node_path); > if (offset == -FDT_ERR_NOTFOUND) > - offset = fdt_add_subnode(fdt, 0, node_path); > + /* Add the node to root if not found, dropping the leading '/' */ > + offset = fdt_add_subnode(fdt, 0, node_path + 1); > return offset; > } >
WARNING: multiple messages have this Message-ID (diff)
From: Chris Packham <Chris.Packham@alliedtelesis.co.nz> To: Rob Herring <robh@kernel.org>, Russell King <linux@armlinux.org.uk> Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, Qi Zheng <arch0.zheng@gmail.com>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org> Subject: Re: [PATCH] ARM: zImage: atags_to_fdt: Fix node names on added root nodes Date: Tue, 26 Jan 2021 02:50:12 +0000 [thread overview] Message-ID: <329a3043-a85f-8177-c3ad-a9c07604a266@alliedtelesis.co.nz> (raw) In-Reply-To: <20210126023905.1631161-1-robh@kernel.org> Hi Rob, On 26/01/21 3:39 pm, Rob Herring wrote: > Commit 7536c7e03e74 ("of/fdt: Remove redundant kbasename function > call") exposed a bug creating DT nodes in the ATAGS to DT fixup code. > Non-existent nodes would mistaken get created with a leading '/'. The > problem was fdt_path_offset() takes a full path while creating a node > with fdt_add_subnode() takes just the basename. > > Since this we only add root child nodes, we can just skip over the '/'. > > Fixes: 7536c7e03e74 ("of/fdt: Remove redundant kbasename function call") > Reported-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > Cc: Qi Zheng <arch0.zheng@gmail.com> > Cc: Russell King <linux@armlinux.org.uk> > Signed-off-by: Rob Herring <robh@kernel.org> Thanks for the quick patch. It doesn't quite seem to work as my system can't find it's initrd (it can with my other hacky patch). It does seem to get the command line info as I'm getting printk output. > --- > arch/arm/boot/compressed/atags_to_fdt.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c > index 8452753efebe..31927d2fe297 100644 > --- a/arch/arm/boot/compressed/atags_to_fdt.c > +++ b/arch/arm/boot/compressed/atags_to_fdt.c > @@ -15,7 +15,8 @@ static int node_offset(void *fdt, const char *node_path) > { > int offset = fdt_path_offset(fdt, node_path); > if (offset == -FDT_ERR_NOTFOUND) > - offset = fdt_add_subnode(fdt, 0, node_path); > + /* Add the node to root if not found, dropping the leading '/' */ > + offset = fdt_add_subnode(fdt, 0, node_path + 1); > return offset; > } > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-01-26 21:12 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-26 2:39 [PATCH] ARM: zImage: atags_to_fdt: Fix node names on added root nodes Rob Herring 2021-01-26 2:39 ` Rob Herring 2021-01-26 2:50 ` Chris Packham [this message] 2021-01-26 2:50 ` Chris Packham 2021-01-26 14:25 ` Rob Herring 2021-01-26 14:25 ` Rob Herring 2021-01-26 20:16 ` Chris Packham 2021-01-26 20:16 ` Chris Packham 2021-01-26 20:26 ` Chris Packham 2021-01-26 20:26 ` Chris Packham 2021-01-26 20:26 ` Chris Packham 2021-01-26 20:26 ` Chris Packham
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=329a3043-a85f-8177-c3ad-a9c07604a266@alliedtelesis.co.nz \ --to=chris.packham@alliedtelesis.co.nz \ --cc=arch0.zheng@gmail.com \ --cc=devicetree@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux@armlinux.org.uk \ --cc=robh@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.