[edk2-devel] [PATCH EDK2 v1 1/1] BaseTools/EfiRom: remove redundant checking of argc

wenyi,xie via groups.io xiewenyi2=huawei.com at groups.io
Tue Dec 15 04:01:11 UTC 2020


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 at edk2.groups.io <devel at edk2.groups.io> On Behalf Of wenyi,xie via groups.io
> Sent: Friday, December 11, 2020 10:32 AM
> To: devel at edk2.groups.io; Feng, Bob C <bob.c.feng at intel.com>; gaoliming at byosoft.com.cn; Chen, Christine <yuwei.chen at intel.com>
> Cc: songdongkuang at huawei.com; xiewenyi2 at 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 at intel.com>
> Cc: Liming Gao <gaoliming at byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen at intel.com>
> Signed-off-by: Wenyi Xie <xiewenyi2 at 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
> 
> 
> 
> 
> 
> 
> .
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68835): https://edk2.groups.io/g/devel/message/68835
Mute This Topic: https://groups.io/mt/78871121/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list