On 14/10/2022 03:57, Longfang Liu wrote:
+static void hisi_acc_vf_debugfs_init(struct hisi_acc_vf_core_device *hisi_acc_vdev) +{
- struct pci_dev *vf_pdev = hisi_acc_vdev->vf_dev;
- struct device *dev = &vf_pdev->dev;
- int ret;
- if (!atomic_read(&hisi_acc_root_ref))
hisi_acc_debugfs_root = debugfs_create_dir("hisi_vfio_acc", NULL);
- atomic_inc(&hisi_acc_root_ref);
This looks totally racy, such that I wonder why even bother using an atomic for hisi_acc_root_ref. Indeed, why is hisi_acc_debugfs_root not created in the driver module init?
Thanks, John