hsakmt: openclose.c: Fix Coverity reported warnings

Add check before close to prevent closing invalid file descriptors

Change-Id: Ie1d50e0d55159512a14a70c1e4be058218aae668
Ta zmiana jest zawarta w:
Shweta Khatri authored and David Yat Sin committed 2024-09-19 19:44:53 +00:00
1 rodzic f3664fd124
złożenie ff6e1b44bf
Plik 1 zmieniony
+2 -1
+2 -1
Wyświetl plik
@@ -227,7 +227,8 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtOpenKFD(void)
return result;
topology_sysfs_failed:
kfd_version_failed:
close(fd);
if (fd >= 0)
close(fd);
open_failed:
pthread_mutex_unlock(&hsakmt_mutex);