Store pointer to vendor struct, fix crash in lock.
This commit is contained in:
parent
b8517880ea
commit
db50c45f35
|
@ -35,6 +35,7 @@ int amd_common_pre_reset(struct vendor_reset_dev *dev)
|
|||
return -ENOMEM;
|
||||
|
||||
dev->vendor_private = priv;
|
||||
priv->vdev = dev;
|
||||
|
||||
spin_lock_init(&priv->pcie_lock);
|
||||
spin_lock_init(&priv->reg_lock);
|
||||
|
@ -80,6 +81,9 @@ int amd_common_post_reset(struct vendor_reset_dev *dev)
|
|||
if (!dev->reset_ret)
|
||||
pci_set_power_state(pdev, PCI_D3hot);
|
||||
|
||||
kzfree(priv);
|
||||
dev->vendor_private = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -96,7 +100,7 @@ int smum_send_msg_to_smc(struct amd_fake_dev *adev, uint16_t msg, uint32_t *resp
|
|||
--timeout)
|
||||
udelay(1);
|
||||
if ((ret = RREG32(mmMP1_SMN_C2PMSG_90)) != 0x1)
|
||||
pci_info(to_vendor_reset_dev(adev->private)->pdev, "SMU error 0x%x (line %d)\n",
|
||||
pci_info(adev->private->vdev->pdev, "SMU error 0x%x (line %d)\n",
|
||||
ret, __LINE__);
|
||||
|
||||
mutex_unlock(&adev->private->smu_lock);
|
||||
|
|
|
@ -163,6 +163,7 @@ struct amd_vendor_private
|
|||
{
|
||||
u16 cfg;
|
||||
|
||||
struct vendor_reset_dev *vdev;
|
||||
struct pci_saved_state *saved_state;
|
||||
struct amd_fake_dev adev;
|
||||
|
||||
|
@ -175,7 +176,6 @@ struct amd_vendor_private
|
|||
struct mutex smu_lock;
|
||||
};
|
||||
|
||||
#define to_vendor_reset_dev(priv) container_of((void *)priv, struct vendor_reset_dev, vendor_private)
|
||||
#define amd_private(vdev) ((struct amd_vendor_private *)(vdev->vendor_private))
|
||||
|
||||
int amd_common_pre_reset(struct vendor_reset_dev *);
|
||||
|
|
|
@ -134,12 +134,12 @@ static int amd_vega10_reset(struct vendor_reset_dev *dev)
|
|||
for (timeout = 100000; timeout; --timeout)
|
||||
{
|
||||
sol = RREG32(mmMP0_SMN_C2PMSG_81);
|
||||
if (sol != 0xFFFFFFFF)
|
||||
if (sol != 0xFFFFFFFF && sol != 0)
|
||||
break;
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
if (sol == 0xFFFFFFFF)
|
||||
if (!sol)
|
||||
{
|
||||
pci_warn(dev->pdev, "Vega10: Timed out waiting for SOL to be valid\n");
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in New Issue