2020-11-03 11:59:16

by Chengsong Ke

[permalink] [raw]
Subject: [PATCH v2] mtd:ubi: Remove useless code in bytes_str_to_int

From: k00524021 <[email protected]>

As a local variable, "endp" is neither refered nor returned
after this line "endp += 2", it looks like a useless code,
suggest to remove it.

Signed-off-by: Chengsong Ke <[email protected]>
---
drivers/mtd/ubi/build.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index e85b04e9716b..46a6dd75e533 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -1351,8 +1351,6 @@ static int bytes_str_to_int(const char *str)
fallthrough;
case 'K':
result *= 1024;
- if (endp[1] == 'i' && endp[2] == 'B')
- endp += 2;
case '\0':
break;
default:
--
2.12.3


2020-11-03 12:38:06

by Richard Weinberger

[permalink] [raw]
Subject: Re: [PATCH v2] mtd:ubi: Remove useless code in bytes_str_to_int

On Tue, Nov 3, 2020 at 1:00 PM Chengsong Ke <[email protected]> wrote:
>
> From: k00524021 <[email protected]>
>
> As a local variable, "endp" is neither refered nor returned
> after this line "endp += 2", it looks like a useless code,
> suggest to remove it.
>
> Signed-off-by: Chengsong Ke <[email protected]>
> ---
> drivers/mtd/ubi/build.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index e85b04e9716b..46a6dd75e533 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -1351,8 +1351,6 @@ static int bytes_str_to_int(const char *str)
> fallthrough;
> case 'K':
> result *= 1024;
> - if (endp[1] == 'i' && endp[2] == 'B')
> - endp += 2;

Makes sense. But why did you send a v2?

--
Thanks,
//richard

2020-11-03 13:19:24

by Chengsong Ke

[permalink] [raw]
Subject: Re: [PATCH v2] mtd:ubi: Remove useless code in bytes_str_to_int

On Tue, Nov 3, 2020 at 1:00 PM Chengsong Ke <[email protected]> wrote:
>
> From: Chengsong Ke <[email protected]>
>
> As a local variable, "endp" is neither refered nor returned after this
> line "endp += 2", it looks like a useless code, suggest to remove it.
>
> Signed-off-by: Chengsong Ke <[email protected]>
> ---
> drivers/mtd/ubi/build.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index
> e85b04e9716b..46a6dd75e533 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -1351,8 +1351,6 @@ static int bytes_str_to_int(const char *str)
> fallthrough;
> case 'K':
> result *= 1024;
> - if (endp[1] == 'i' && endp[2] == 'B')
> - endp += 2;

> Makes sense. But why did you send a v2?

> --
> Thanks,
> //richard

I just send the v1 with the wrong module name 'ubifs'.
[PATCH] ubifs: Remove useless code in bytes_str_to_int
:-)
Thanks,
//Chengsong Ke

2020-12-11 11:41:09

by Chengsong Ke

[permalink] [raw]
Subject: Re: [PATCH v2] mtd:ubi: Remove useless code in bytes_str_to_int

On Tue, Nov 3, 2020 at 1:00 PM Chengsong Ke <[email protected]> wrote:
>
> From: Chengsong Ke <[email protected]>
>
> As a local variable, "endp" is neither refered nor returned after this
> line "endp += 2", it looks like a useless code, suggest to remove it.
>
> Signed-off-by: Chengsong Ke <[email protected]>
> ---
> drivers/mtd/ubi/build.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index
> e85b04e9716b..46a6dd75e533 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -1351,8 +1351,6 @@ static int bytes_str_to_int(const char *str)
> fallthrough;
> case 'K':
> result *= 1024;
> - if (endp[1] == 'i' && endp[2] == 'B')
> - endp += 2;

> Makes sense. But why did you send a v2?

> --
> Thanks,
> //richard

> I just send the v1 with the wrong module name 'ubifs'.
> [PATCH] ubifs: Remove useless code in bytes_str_to_int
> :-)
> Thanks,
> //Chengsong Ke
ping