2
0

Update error codes for hipGetDevice for doxygen and move up null check (#1668)

* [docs] Update error codes for hipGetDevice

* Move up out ptr check
Este cometimento está contido em:
Rahul Garg
2019-11-20 08:05:27 -08:00
cometido por Maneesh Gupta
ascendente 57b1b03261
cometimento 13c2a31d7e
2 ficheiros modificados com 7 adições e 9 eliminações
+6 -8
Ver ficheiro
@@ -33,18 +33,16 @@ hipError_t hipGetDevice(int* deviceId) {
HIP_INIT_API(hipGetDevice, deviceId);
hipError_t e = hipSuccess;
if (deviceId == nullptr)
return ihipLogStatus(hipErrorInvalidValue);
auto ctx = ihipGetTlsDefaultCtx();
if (deviceId != nullptr) {
if (ctx == nullptr) {
e = hipErrorInvalidDevice; // TODO, check error code.
*deviceId = -1;
} else {
*deviceId = ctx->getDevice()->_deviceId;
}
if (ctx == nullptr) {
e = hipErrorInvalidDevice; // TODO, check error code.
*deviceId = -1;
} else {
e = hipErrorInvalidValue;
*deviceId = ctx->getDevice()->_deviceId;
}
return ihipLogStatus(e);