Input args NULL check in hipChooseDevice

Change-Id: I1a7b8cded2f81d739645bbf3dab2f04bb9c3c796


[ROCm/hip commit: a833b9a704]
Αυτή η υποβολή περιλαμβάνεται σε:
Rahul Garg
2017-06-13 13:35:50 +05:30
γονέας aaa09cbf1c
υποβολή 0e4dbe0b2f
@@ -415,6 +415,10 @@ hipError_t hipChooseDevice( int* device, const hipDeviceProp_t* prop )
int inPropCount = 0; int inPropCount = 0;
int matchedPropCount = 0; int matchedPropCount = 0;
hipError_t e = hipSuccess; hipError_t e = hipSuccess;
if((device == NULL) || (prop == NULL)) {
e = hipErrorInvalidValue;
}
if(e == hipSuccess) {
ihipGetDeviceCount( &deviceCount ); ihipGetDeviceCount( &deviceCount );
*device = 0; *device = 0;
for (int i = 0; i < deviceCount; i++) { for (int i = 0; i < deviceCount; i++) {
@@ -482,5 +486,7 @@ hipError_t hipChooseDevice( int* device, const hipDeviceProp_t* prop )
} }
#endif #endif
} }
}
return ihipLogStatus(e); return ihipLogStatus(e);
} }