public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH EDK2 v1 0/1] BaseTools/EfiRom: remove redundant checking of argc
@ 2020-12-11  2:31 wenyi,xie
  2020-12-11  2:31 ` [PATCH EDK2 v1 1/1] " wenyi,xie
  0 siblings, 1 reply; 4+ messages in thread
From: wenyi,xie @ 2020-12-11  2:31 UTC (permalink / raw)
  To: devel, bob.c.feng, gaoliming, yuwei.chen; +Cc: songdongkuang, xiewenyi2

Main Changes :
As the condition of while statement is argc > 0, so argc < 1 will always
be false.

Wenyi Xie (1):
  BaseTools/EfiRom: remove redundant checking of argc

 BaseTools/Source/C/EfiRom/EfiRom.c | 10 ----------
 1 file changed, 10 deletions(-)

-- 
2.20.1.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH EDK2 v1 1/1] BaseTools/EfiRom: remove redundant checking of argc
  2020-12-11  2:31 [PATCH EDK2 v1 0/1] BaseTools/EfiRom: remove redundant checking of argc wenyi,xie
@ 2020-12-11  2:31 ` wenyi,xie
  2020-12-15  3:50   ` [edk2-devel] " Bob Feng
  0 siblings, 1 reply; 4+ messages in thread
From: wenyi,xie @ 2020-12-11  2:31 UTC (permalink / raw)
  To: devel, bob.c.feng, gaoliming, yuwei.chen; +Cc: songdongkuang, xiewenyi2

As the condition of while statement is argc > 0, so argc < 1 will always
be false, it's redundant.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
 BaseTools/Source/C/EfiRom/EfiRom.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c
index a7e2839b0a84..147eb464b01e 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.c
+++ b/BaseTools/Source/C/EfiRom/EfiRom.c
@@ -1010,16 +1010,6 @@ Returns:
 
         OptionName = Argv[0];
 
-        //
-        // Device IDs specified with -i
-        // Make sure there's at least one more parameter
-        //
-        if (Argc < 1) {
-          Error (NULL, 0, 2000, "Invalid parameter", "Missing Device Id with %s option!", OptionName);
-          ReturnStatus = 1;
-          goto Done;
-        }
-
         //
         // Process until another dash-argument parameter or the end of the list
         //
-- 
2.20.1.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools/EfiRom: remove redundant checking of argc
  2020-12-11  2:31 ` [PATCH EDK2 v1 1/1] " wenyi,xie
@ 2020-12-15  3:50   ` Bob Feng
  2020-12-15  4:01     ` wenyi,xie
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Feng @ 2020-12-15  3:50 UTC (permalink / raw)
  To: devel@edk2.groups.io, xiewenyi2@huawei.com,
	gaoliming@byosoft.com.cn, Chen, Christine
  Cc: songdongkuang@huawei.com

Yes, argc < 1 will always be false, but I think this block should not be removed because it's used to check if the parameter is invalid. I think the correct checking should be "if (Argc == 1)"  or  "if (Argc < 2)"

Thanks,
Bob

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of wenyi,xie via groups.io
Sent: Friday, December 11, 2020 10:32 AM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>; gaoliming@byosoft.com.cn; Chen, Christine <yuwei.chen@intel.com>
Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com
Subject: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools/EfiRom: remove redundant checking of argc

As the condition of while statement is argc > 0, so argc < 1 will always be false, it's redundant.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
 BaseTools/Source/C/EfiRom/EfiRom.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c
index a7e2839b0a84..147eb464b01e 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.c
+++ b/BaseTools/Source/C/EfiRom/EfiRom.c
@@ -1010,16 +1010,6 @@ Returns:
 
         OptionName = Argv[0];
 
-        //
-        // Device IDs specified with -i
-        // Make sure there's at least one more parameter
-        //
-        if (Argc < 1) {
-          Error (NULL, 0, 2000, "Invalid parameter", "Missing Device Id with %s option!", OptionName);
-          ReturnStatus = 1;
-          goto Done;
-        }
-
         //
         // Process until another dash-argument parameter or the end of the list
         //
--
2.20.1.windows.1







^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools/EfiRom: remove redundant checking of argc
  2020-12-15  3:50   ` [edk2-devel] " Bob Feng
@ 2020-12-15  4:01     ` wenyi,xie
  0 siblings, 0 replies; 4+ messages in thread
From: wenyi,xie @ 2020-12-15  4:01 UTC (permalink / raw)
  To: Feng, Bob C, devel@edk2.groups.io, gaoliming@byosoft.com.cn,
	Chen, Christine
  Cc: songdongkuang@huawei.com

OK, I will change the checking to if (Argc == 1)

Thanks
Wenyi

On 2020/12/15 11:50, Feng, Bob C wrote:
> Yes, argc < 1 will always be false, but I think this block should not be removed because it's used to check if the parameter is invalid. I think the correct checking should be "if (Argc == 1)"  or  "if (Argc < 2)"
> 
> Thanks,
> Bob
> 
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of wenyi,xie via groups.io
> Sent: Friday, December 11, 2020 10:32 AM
> To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>; gaoliming@byosoft.com.cn; Chen, Christine <yuwei.chen@intel.com>
> Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com
> Subject: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools/EfiRom: remove redundant checking of argc
> 
> As the condition of while statement is argc > 0, so argc < 1 will always be false, it's redundant.
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
> ---
>  BaseTools/Source/C/EfiRom/EfiRom.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c
> index a7e2839b0a84..147eb464b01e 100644
> --- a/BaseTools/Source/C/EfiRom/EfiRom.c
> +++ b/BaseTools/Source/C/EfiRom/EfiRom.c
> @@ -1010,16 +1010,6 @@ Returns:
>  
>          OptionName = Argv[0];
>  
> -        //
> -        // Device IDs specified with -i
> -        // Make sure there's at least one more parameter
> -        //
> -        if (Argc < 1) {
> -          Error (NULL, 0, 2000, "Invalid parameter", "Missing Device Id with %s option!", OptionName);
> -          ReturnStatus = 1;
> -          goto Done;
> -        }
> -
>          //
>          // Process until another dash-argument parameter or the end of the list
>          //
> --
> 2.20.1.windows.1
> 
> 
> 
> 
> 
> 
> .
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-15  4:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-11  2:31 [PATCH EDK2 v1 0/1] BaseTools/EfiRom: remove redundant checking of argc wenyi,xie
2020-12-11  2:31 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2020-12-15  3:50   ` [edk2-devel] " Bob Feng
2020-12-15  4:01     ` wenyi,xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox