hsakmt: openclose.c: Fix Coverity reported warnings

Add check before close to prevent closing invalid file descriptors

Change-Id: Ie1d50e0d55159512a14a70c1e4be058218aae668
Tá an tiomantas seo le fáil i:
Shweta Khatri údaraithe agus David Yat Sin tiomanta 2024-09-19 19:44:53 +00:00
1 tuismitheoir f3664fd124
tiomantas ff6e1b44bf
1 comhad athraithe
+2 -1
+2 -1
Féach ar an gComhad
@@ -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);