From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mx.groups.io with SMTP id smtpd.web11.5869.1608004893364308015 for ; Mon, 14 Dec 2020 20:01:34 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.35, mailfrom: xiewenyi2@huawei.com) Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Cw4L72S9Zz7Fcs; Tue, 15 Dec 2020 12:00:47 +0800 (CST) Received: from [10.174.154.225] (10.174.154.225) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Tue, 15 Dec 2020 12:01:16 +0800 Subject: Re: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools/EfiRom: remove redundant checking of argc To: "Feng, Bob C" , "devel@edk2.groups.io" , "gaoliming@byosoft.com.cn" , "Chen, Christine" CC: "songdongkuang@huawei.com" References: <1607653903-125927-1-git-send-email-xiewenyi2@huawei.com> <1607653903-125927-2-git-send-email-xiewenyi2@huawei.com> From: "wenyi,xie" Message-ID: <554b1537-ca5d-08c9-0f56-f68f99da8de2@huawei.com> Date: Tue, 15 Dec 2020 12:01:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.0.1 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.174.154.225] X-CFilter-Loop: Reflected Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit 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 On Behalf Of wenyi,xie via groups.io > Sent: Friday, December 11, 2020 10:32 AM > To: devel@edk2.groups.io; Feng, Bob C ; gaoliming@byosoft.com.cn; Chen, Christine > 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 > Cc: Liming Gao > Cc: Yuwei Chen > Signed-off-by: Wenyi Xie > --- > 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 > > > > > > > . >