hsakmt: openclose.c: Fix Coverity reported warnings

Add check before close to prevent closing invalid file descriptors

Change-Id: Ie1d50e0d55159512a14a70c1e4be058218aae668
Cette révision appartient à :
Shweta Khatri a créé et David Yat Sin a révisé 2024-09-19 19:44:53 +00:00
1 Parent f3664fd124
révision ff6e1b44bf
1 fichier modifié
+2 -1
+2 -1
Voir le fichier
@@ -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);