From 7145ea6a4ab65c3497e1602cbbd233d8a9aedb27 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Mon, 21 Nov 2016 18:07:01 -0600 Subject: [PATCH] fixed error output for hipDeviceGetAttribute Change-Id: I1e343a4e4e20e1a550d419f701cc1e60e9d03af4 --- src/hip_device.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hip_device.cpp b/src/hip_device.cpp index 5bf7c5bf4e..51fd5e4f81 100644 --- a/src/hip_device.cpp +++ b/src/hip_device.cpp @@ -174,7 +174,9 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device) hipError_t e = hipSuccess; - if(pi != nullptr) { + if(pi == nullptr) { + return ihipLogStatus(hipErrorInvalidValue); + } auto * hipDevice = ihipGetDevice(device); hipDeviceProp_t *prop = &hipDevice->_props; @@ -236,9 +238,6 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device) } else { e = hipErrorInvalidDevice; } - }else{ - e = hipErrorInvalidDevice; - } return ihipLogStatus(e); }