mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] of: partition: skip NVMEM partition setup partition parsing fails
@ 2023-03-14  8:58 Ahmad Fatoum
  2023-03-14  8:58 ` [PATCH master 2/2] commands: stat: fix UUID print Ahmad Fatoum
  2023-03-14  9:02 ` [PATCH master 1/2] of: partition: skip NVMEM partition setup partition parsing fails Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-03-14  8:58 UTC (permalink / raw)
  To: barebox; +Cc: sha, Ahmad Fatoum

nvmem_partition_register should not be called with a NULL pointer
argument, yet this is what happened when a partition with a nvmem-cells
compatible conflicts with a partition parsed from an on-disk partition
table. Fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/partition.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index ed1114193062..40c47f554ad2 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -70,10 +70,10 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
 	if (IS_ERR(new)) {
 		pr_err("Adding partition %s failed: %pe\n", filename, new);
 		new = NULL;
+		goto out;
 	}
 
-	if (new)
-		new->device_node = node;
+	new->device_node = node;
 
 	if (IS_ENABLED(CONFIG_NVMEM) && of_device_is_compatible(node, "nvmem-cells")) {
 		struct nvmem_device *nvmem = nvmem_partition_register(new);
@@ -81,6 +81,7 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
 			dev_warn(cdev->dev, "nvmem registeration failed: %pe\n", nvmem);
 	}
 
+out:
 	free(filename);
 
 	return new;
-- 
2.30.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-14 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14  8:58 [PATCH master 1/2] of: partition: skip NVMEM partition setup partition parsing fails Ahmad Fatoum
2023-03-14  8:58 ` [PATCH master 2/2] commands: stat: fix UUID print Ahmad Fatoum
2023-03-14  9:02 ` [PATCH master 1/2] of: partition: skip NVMEM partition setup partition parsing fails Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox