I considered the least code change approach without considering any optimization which also works as such. However, yes, the duplicated /unnecessary subsequent checks can be removed. On Tue, Nov 7, 2023 at 9:51 PM Laszlo Ersek wrote: > On 11/7/23 07:19, Ranbir Singh wrote: > > From: Ranbir Singh > > > > The function PciHotPlugRequestNotify has two if blocks towards the end > > of function both containing return. Due to the parameter checks ensured > > at the beginning of the function, one of the two if blocks is bound to > > come in execution flow. Hence, the return EFI_SUCCESS; at line 2112 is > > redundant/deadcode. > > Agree with the analysis. > > > > > To fix it, either of line 2109 or 2112 can be deleted. > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4239 > > > > Cc: Ray Ni > > Co-authored-by: Veeresh Sangolli > > Signed-off-by: Ranbir Singh > > Signed-off-by: Ranbir Singh > > --- > > MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c > > index 3f8c6e6da7dc..5b71e152f3ea 100644 > > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c > > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c > > @@ -2106,7 +2106,6 @@ PciHotPlugRequestNotify ( > > // > > // End for > > // > > - return EFI_SUCCESS; > > } > > > > return EFI_SUCCESS; > > Disagree with the fix. > > Given the checks on "Operation" at the top of the function, the > condition (near the end of the function) > > if (Operation == EfiPciHotplugRequestRemove) { > > will always evaluate to TRUE. (Operation can be only Add or Remove, and > if it is Add, then we don't reach this location.) > > Therefore, we should remove this condition, and *unnest* the dependent > logic. > > As a result of *that*, you'll have > > return EFI_SUCCESS; > return EFI_SUCCESS; > > at the end of the function, and *then* you should remove either one of > them. > > Thanks > Laszlo > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111018): https://edk2.groups.io/g/devel/message/111018 Mute This Topic: https://groups.io/mt/102438298/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-