diff mbox

[U-Boot] common: mmc: unsigned char compared against 0

Message ID 1448442981-14127-2-git-send-email-Peng.Fan@freescale.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Peng Fan Nov. 25, 2015, 9:16 a.m. UTC
"enable" is unsigned char type and its value will not be
negative, so discard "enable < 0".

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
 common/cmd_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Nov. 27, 2015, 2:51 a.m. UTC | #1
Hi Peng,

On 25 November 2015 at 01:16, Peng Fan <Peng.Fan@freescale.com> wrote:
> "enable" is unsigned char type and its value will not be
> negative, so discard "enable < 0".
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>  common/cmd_mmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Even better if this variable changed to uint, instead of u8.

Regards,
Simon
Peng Fan Nov. 27, 2015, 4:58 a.m. UTC | #2
Hi Simon,
On Thu, Nov 26, 2015 at 06:51:58PM -0800, Simon Glass wrote:
>Hi Peng,
>
>On 25 November 2015 at 01:16, Peng Fan <Peng.Fan@freescale.com> wrote:
>> "enable" is unsigned char type and its value will not be
>> negative, so discard "enable < 0".
>>
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>> Cc: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
>> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
>> Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> Cc: Stefano Babic <sbabic@denx.de>
>> Cc: Tom Rini <trini@konsulko.com>
>> ---
>>  common/cmd_mmc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
>Reviewed-by: Simon Glass <sjg@chromium.org>
>
>Even better if this variable changed to uint, instead of u8.
Thanks for reviewing, But I prefer to let it be, since mmc_set_rst_n_function
takes u8 type for input parameter.

Thanks,
Peng.
>
>Regards,
>Simon
Tom Rini Dec. 6, 2015, 10:06 p.m. UTC | #3
On Wed, Nov 25, 2015 at 05:16:21PM +0800, Peng Fan wrote:

> "enable" is unsigned char type and its value will not be
> negative, so discard "enable < 0".
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Tom Rini <trini@konsulko.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index dfc1ec8..a6b7313 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -747,7 +747,7 @@  static int do_mmc_rst_func(cmd_tbl_t *cmdtp, int flag,
 	dev = simple_strtoul(argv[1], NULL, 10);
 	enable = simple_strtoul(argv[2], NULL, 10);
 
-	if (enable > 2 || enable < 0) {
+	if (enable > 2) {
 		puts("Invalid RST_n_ENABLE value\n");
 		return CMD_RET_USAGE;
 	}