archive mirror
 help / color / mirror / Atom feed
From: Martin Kaiser <>
To: Miquel Raynal <>
Cc: Dan Carpenter <>,
	Manivannan Sadhasivam <>,
	Richard Weinberger <>,
	Vignesh Raghavendra <>,
	Boris Brezillon <>,
	Tudor Ambarus <>,,
Subject: Re: [PATCH] mtd: rawnand: Add a check in of_get_nand_secure_regions()
Date: Sat, 24 Jul 2021 16:27:30 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi all,

Thus wrote Miquel Raynal (

> On Thu, 2021-06-17 at 13:37:25 UTC, Dan Carpenter wrote:
> > Check for whether of_property_count_elems_of_size() returns a negative
> > error code.

> > Fixes: 13b89768275d ("mtd: rawnand: Add support for secure regions in NAND memory")
> > Signed-off-by: Dan Carpenter <>
> > Reviewed-by: Manivannan Sadhasivam <>

> Applied to mtd/fixes, thanks.

I'm running linux-next on an imx25 system with the following flash chip

[    1.997539] nand: device found, Manufacturer ID: 0x98, Chip ID: 0xaa
[    2.004134] nand: Toshiba NAND 256MiB 1,8V 8-bit
[    2.008917] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 128

The system is using the drivers/mtd/nand/raw/mxc_nand.c driver.

Since this commit appeared in linux-next, mxc_nand's probe function fails
with -EINVAL, taking this path


nr_elem = of_property_count_elems_of_size(dn, "secure-regions", sizeof(u64));
returns -EINVAL as there's no secure-regions property in my device tree.

We should certainly handle negative error codes before we calculate
chip->nr_secure_regions = nr_elem / 2
but a missing secure-regions property is a valid case and should not make
the probe fail.

If the property exists, but the device-tree entry is incorrect
and of_property_count_elems_of_size returns -ENODATA, we might print a
warning and ignore the entry.

What do you think?



  reply	other threads:[~2021-07-24 14:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 13:37 [PATCH] mtd: rawnand: Add a check in of_get_nand_secure_regions() Dan Carpenter
2021-06-25  9:50 ` Manivannan Sadhasivam
2021-07-15 22:50 ` Miquel Raynal
2021-07-24 14:27   ` Martin Kaiser [this message]
2021-07-24 16:03     ` Manivannan Sadhasivam
2021-07-26  7:58       ` Miquel Raynal

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).