The references to the device state are not dropped
everywhere. This might cause a dead-lock in
amd_iommu_free_device(). Fix it.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Tested-by: Oded Gabbay <oded.gabbay@amd.com>
 
                put_pasid_state_wait(pasid_state); /* Reference taken in
                                                      amd_iommu_pasid_bind */
+
+               /* Drop reference taken in amd_iommu_bind_pasid */
+               put_device_state(dev_state);
        }
 
        if (dev_state->pasid_levels == 2)
        put_pasid_state_wait(pasid_state); /* Reference taken in
                                              amd_iommu_pasid_bind */
 out:
+       /* Drop reference taken in this function */
+       put_device_state(dev_state);
+
+       /* Drop reference taken in amd_iommu_bind_pasid */
        put_device_state(dev_state);
 }
 EXPORT_SYMBOL(amd_iommu_unbind_pasid);