- SourceSize = GetDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
-\r
- //\r
- // The source path can only have 1 instance\r
- //\r
- if (IsDevicePathMultiInstance (SourcePath)) {\r
- DEBUG((DEBUG_ERROR, "LocateDevicePath: Device path has too many instances\n"));\r
- return EFI_INVALID_PARAMETER;\r
+ TmpDevicePath = SourcePath;\r
+ while (!IsDevicePathEnd (TmpDevicePath)) {\r
+ if (IsDevicePathEndInstance (TmpDevicePath)) {\r
+ //\r
+ // If DevicePath is a multi-instance device path,\r
+ // the function will operate on the first instance \r
+ //\r
+ break;\r
+ }\r
+ TmpDevicePath = NextDevicePathNode (TmpDevicePath);\r