mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Pascal Vizeli <pvizeli@syshack.ch>
To: barebox@lists.infradead.org
Cc: Pascal Vizeli <pvizeli@syshack.ch>
Subject: [PATCH 1/1] drivers: of: bugfix partition fixups
Date: Thu,  7 Jun 2018 17:40:11 +0000	[thread overview]
Message-ID: <20180607174011.13130-1-pvizeli@syshack.ch> (raw)

If we load a new device tree for linux kernel with a diferent layout,
the fixup of partition going into endless loop. Exactly the of_find_property
function will never come back on a invalid device_node.

My patch check, if the device will exists on device tree before we run the
fixup.

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
---
 drivers/of/partition.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index aa6e601b7..17e420964 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -140,6 +140,9 @@ static int of_partition_fixup(struct device_node *root, void *ctx)
 	if (!cdev->device_node)
 		return -EINVAL;
 
+	if (!of_find_node_by_path(cdev->device_node->full_name))
+		return -EINVAL;
+
 	list_for_each_entry(partcdev, &cdev->partitions, partition_entry) {
 		if (partcdev->flags & DEVFS_PARTITION_FROM_TABLE)
 			continue;
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2018-06-07 17:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 17:40 Pascal Vizeli [this message]
2018-06-08  7:05 ` Sascha Hauer
2018-06-08  7:31   ` Pascal Vizeli
2018-06-11  6:41     ` Sascha Hauer

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=20180607174011.13130-1-pvizeli@syshack.ch \
    --to=pvizeli@syshack.ch \
    --cc=barebox@lists.infradead.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox