[PATCH 2/3] mtd: ofpart: do not fail probe when no partitions exist

Michal Suchanek hramrach at gmail.com
Mon Jul 27 13:30:43 PDT 2015


On Exynos it is necessary to set SPI controller parameters that apply to
a SPI slave in a DT subnode of the slave device.  Example:

flash: m25p80 at 0 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "jedec,spi-nor";
        reg = <0>;
        spi-max-frequency = <40000000>;
        m25p,fast-read;
        controller-data {
            samsung,spi-feedback-delay = <0>;
        };
};

The ofpart code checks if there are any subnodes on the MTD device DT
node and if so it tries to parse them as MTD partitions (example below)

flash at 0 {
        #address-cells = <1>;
        #size-cells = <1>;

        partition at 0 {
                label = "u-boot";
                reg = <0x0000000 0x100000>;
                read-only;
        };

        uimage at 100000 {
                reg = <0x0100000 0x200000>;
        };
};

The controller-data node contains no partition information and no other
subnodes with partition information exist.

The ofpart code returns an error when there are subnodes of the flash DT
node but no partitions are found. This error is then propagated to
mtdpart which propagetes it to MTD probe which fails probing the flash
device.

Change this condition to a warning so that flash without partitions can
be accessed on Exynos with ofpart support compiled in.

Signed-off-by: Michal Suchanek <hramrach at gmail.com>

--
 - add more verbose explanation
---
 drivers/mtd/ofpart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index aa26c32..a29d29f 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -94,10 +94,10 @@ static int parse_ofpart_partitions(struct mtd_info *master,
 
 	if (!i) {
 		of_node_put(pp);
-		pr_err("No valid partition found on %s\n", node->full_name);
+		pr_warn("No valid partition found on %s\n", node->full_name);
 		kfree(*pparts);
 		*pparts = NULL;
-		return -EINVAL;
+		return 0;
 	}
 
 	return nr_parts;
-- 
2.1.4




More information about the linux-mtd mailing list