diff mbox series

[v2] mtd: parsers: qcom: incompatible with spi-nor 4k sectors

Message ID 0a2611f885b894274436ded3ca78bc0440fca74a.1614790096.git.baruch@tkos.co.il (mailing list archive)
State Accepted
Commit 8f62f59f83c3bc902af91c80732cfcd17e0d7069
Headers show
Series [v2] mtd: parsers: qcom: incompatible with spi-nor 4k sectors | expand

Commit Message

Baruch Siach March 3, 2021, 4:48 p.m. UTC
Partition size and offset value are in block size units, which is the
same as 'erasesize'. But when 4K sectors are enabled erasesize is set to
4K. Bail out in that case.

Fixes: 803eb124e1a64 ("mtd: parsers: Add Qcom SMEM parser")
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
v2:

  * Improve error message (Manivannan Sadhasivam)

  * Add Fixes tag (Miquel Raynal)
---
 drivers/mtd/parsers/qcomsmempart.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Miquel Raynal March 11, 2021, 11:39 a.m. UTC | #1
On Wed, 2021-03-03 at 16:48:16 UTC, Baruch Siach wrote:
> Partition size and offset value are in block size units, which is the
> same as 'erasesize'. But when 4K sectors are enabled erasesize is set to
> 4K. Bail out in that case.
> 
> Fixes: 803eb124e1a64 ("mtd: parsers: Add Qcom SMEM parser")
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel
patchwork-bot+linux-arm-msm@kernel.org May 26, 2021, 7:03 p.m. UTC | #2
Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Wed,  3 Mar 2021 18:48:16 +0200 you wrote:
> Partition size and offset value are in block size units, which is the
> same as 'erasesize'. But when 4K sectors are enabled erasesize is set to
> 4K. Bail out in that case.
> 
> Fixes: 803eb124e1a64 ("mtd: parsers: Add Qcom SMEM parser")
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> 
> [...]

Here is the summary with links:
  - [v2] mtd: parsers: qcom: incompatible with spi-nor 4k sectors
    https://git.kernel.org/qcom/c/8f62f59f83c3

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/mtd/parsers/qcomsmempart.c b/drivers/mtd/parsers/qcomsmempart.c
index 808cb33d71f8..73b75a30e0ad 100644
--- a/drivers/mtd/parsers/qcomsmempart.c
+++ b/drivers/mtd/parsers/qcomsmempart.c
@@ -65,6 +65,13 @@  static int parse_qcomsmem_part(struct mtd_info *mtd,
 	int ret, i, numparts;
 	char *name, *c;
 
+	if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_4K_SECTORS)
+			&& mtd->type == MTD_NORFLASH) {
+		pr_err("%s: SMEM partition parser is incompatible with 4K sectors\n",
+				mtd->name);
+		return -EINVAL;
+	}
+
 	pr_debug("Parsing partition table info from SMEM\n");
 	ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len);
 	if (IS_ERR(ptable)) {