api: return correct error when there's a duplicate

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-11-02 17:18:39 +01:00
parent 283f6c8e63
commit 351349b4c4

View File

@ -1597,10 +1597,10 @@ CreateAdapter(
PropertyType == DEVPROP_TYPE_NTSTATUS) PropertyType == DEVPROP_TYPE_NTSTATUS)
{ {
Result = RtlNtStatusToDosError(ProblemStatus); Result = RtlNtStatusToDosError(ProblemStatus);
_Analysis_assume_(Result != ERROR_SUCCESS);
if (ProblemStatus != STATUS_PNP_DEVICE_CONFIGURATION_PENDING || Tries == 999) if (ProblemStatus != STATUS_PNP_DEVICE_CONFIGURATION_PENDING || Tries == 999)
{ {
LOG_ERROR(L"Failed to setup adapter", Result); LOG_ERROR(L"Failed to setup adapter", Result);
Result = ERROR_GEN_FAILURE;
goto cleanupTcpipInterfaceRegKey; goto cleanupTcpipInterfaceRegKey;
} }
Sleep(10); Sleep(10);
@ -1608,6 +1608,7 @@ CreateAdapter(
else else
break; break;
} }
Result = ERROR_SUCCESS;
*Adapter = a; *Adapter = a;