[v4,12/14] dfu_mtd: Ignore non-implemented lock device failure

Message ID 162140319389.47256.629728945246178860.stgit@localhost
State New
Headers show
Series
  • arm64: synquacer: Add SynQuacer/DeveloperBox support
Related show

Commit Message

Masami Hiramatsu May 19, 2021, 5:46 a.m.
Ignore the non-implemented lock device failure on writing mtd
via DFU. Without this fix, DFU write shows an error on such device
even if it succeeded, because dfu->write_medium returns -EOPNOTSUPP.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

Cc: Lukasz Majewski <lukma@denx.de>
---
 drivers/dfu/dfu_mtd.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Sughosh Ganu May 19, 2021, 6:07 a.m. | #1
On Wed, 19 May 2021 at 11:16, Masami Hiramatsu <masami.hiramatsu@linaro.org>
wrote:

> Ignore the non-implemented lock device failure on writing mtd

> via DFU. Without this fix, DFU write shows an error on such device

> even if it succeeded, because dfu->write_medium returns -EOPNOTSUPP.

>

> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

> Cc: Lukasz Majewski <lukma@denx.de>

> ---

>  drivers/dfu/dfu_mtd.c |    2 ++

>  1 file changed, 2 insertions(+)

>


A patch has already been submitted for this[1].

Patrick, can you please apply this in your tree and send it as part of the
next PR. Thanks.

-sughosh

[1] - https://lists.denx.de/pipermail/u-boot/2021-March/443896.html



> diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c

> index ca67585a7e..e58302c32d 100644

> --- a/drivers/dfu/dfu_mtd.c

> +++ b/drivers/dfu/dfu_mtd.c

> @@ -152,6 +152,8 @@ static int mtd_block_op(enum dfu_op op, struct

> dfu_entity *dfu,

>                 ret = mtd_lock(mtd, lock_ofs, lock_len);

>                 if (ret && ret != -EOPNOTSUPP)

>                         printf("MTD device lock failed\n");

> +               if (ret == -EOPNOTSUPP)

> +                       ret = 0;

>         }

>         return ret;

>  }

>

>
Masami Hiramatsu May 19, 2021, 6:34 a.m. | #2
Hi Sughosh,

2021年5月19日(水) 15:07 Sughosh Ganu <sughosh.ganu@linaro.org>:
>

>

>

> On Wed, 19 May 2021 at 11:16, Masami Hiramatsu <masami.hiramatsu@linaro.org> wrote:

>>

>> Ignore the non-implemented lock device failure on writing mtd

>> via DFU. Without this fix, DFU write shows an error on such device

>> even if it succeeded, because dfu->write_medium returns -EOPNOTSUPP.

>>

>> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

>> Cc: Lukasz Majewski <lukma@denx.de>

>> ---

>>  drivers/dfu/dfu_mtd.c |    2 ++

>>  1 file changed, 2 insertions(+)

>

>

> A patch has already been submitted for this[1].


Ah, thanks for pointing! If that is merged, I can drop this patch.

Thank you,

>

> Patrick, can you please apply this in your tree and send it as part of the next PR. Thanks.

>

> -sughosh

>

> [1] - https://lists.denx.de/pipermail/u-boot/2021-March/443896.html

>

>

>>

>> diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c

>> index ca67585a7e..e58302c32d 100644

>> --- a/drivers/dfu/dfu_mtd.c

>> +++ b/drivers/dfu/dfu_mtd.c

>> @@ -152,6 +152,8 @@ static int mtd_block_op(enum dfu_op op, struct dfu_entity *dfu,

>>                 ret = mtd_lock(mtd, lock_ofs, lock_len);

>>                 if (ret && ret != -EOPNOTSUPP)

>>                         printf("MTD device lock failed\n");

>> +               if (ret == -EOPNOTSUPP)

>> +                       ret = 0;

>>         }

>>         return ret;

>>  }

>>



-- 
Masami Hiramatsu
Patrick DELAUNAY May 28, 2021, 8:50 a.m. | #3
On 5/19/21 8:07 AM, Sughosh Ganu wrote:
> On Wed, 19 May 2021 at 11:16, Masami Hiramatsu <masami.hiramatsu@linaro.org>

> wrote:

>

>> Ignore the non-implemented lock device failure on writing mtd

>> via DFU. Without this fix, DFU write shows an error on such device

>> even if it succeeded, because dfu->write_medium returns -EOPNOTSUPP.

>>

>> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

>> Cc: Lukasz Majewski <lukma@denx.de>

>> ---

>>   drivers/dfu/dfu_mtd.c |    2 ++

>>   1 file changed, 2 insertions(+)

>>

> A patch has already been submitted for this[1].

>

> Patrick, can you please apply this in your tree and send it as part of the

> next PR. Thanks.



Ok, I take the patch in my next PR


>

> -sughosh

>

> [1] - https://lists.denx.de/pipermail/u-boot/2021-March/443896.html

>

>

>

>> diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c

>> index ca67585a7e..e58302c32d 100644

>> --- a/drivers/dfu/dfu_mtd.c

>> +++ b/drivers/dfu/dfu_mtd.c

>> @@ -152,6 +152,8 @@ static int mtd_block_op(enum dfu_op op, struct

>> dfu_entity *dfu,

>>                  ret = mtd_lock(mtd, lock_ofs, lock_len);

>>                  if (ret && ret != -EOPNOTSUPP)

>>                          printf("MTD device lock failed\n");

>> +               if (ret == -EOPNOTSUPP)

>> +                       ret = 0;

>>          }

>>          return ret;

>>   }

>>

>>

Patch

diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c
index ca67585a7e..e58302c32d 100644
--- a/drivers/dfu/dfu_mtd.c
+++ b/drivers/dfu/dfu_mtd.c
@@ -152,6 +152,8 @@  static int mtd_block_op(enum dfu_op op, struct dfu_entity *dfu,
 		ret = mtd_lock(mtd, lock_ofs, lock_len);
 		if (ret && ret != -EOPNOTSUPP)
 			printf("MTD device lock failed\n");
+		if (ret == -EOPNOTSUPP)
+			ret = 0;
 	}
 	return ret;
 }