Skip to contentSkip to conversation

i2c: i2c-amd-mp2-pci: Fix Oops in amd_mp2_pci_init() error handling

PATCH Applied Dan Carpenter 4 participants 5 messages Sep 10, 2019 – May 1, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c: i2c-amd-mp2-pci: Fix Oops in amd_mp2_pci_init() error handling

The problem is that we dereference "privdata->pci_dev" when we print the error messages in amd_mp2_pci_init():

	dev_err(ndev_dev(privdata), "Failed to enable MP2 PCI device\n");
		^^^^^^^^^^^^^^^^^
Fixes 529766e0a011 ("i2c: Add drivers for the AMD PCIe MP2 I2C controller")

---
v2: style change

 drivers/i2c/busses/i2c-amd-mp2-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-amd-mp2-pci.c +1 -1
index 5e4800d72e00..cd3fd5ee5f65 100644
@@ -349,12 +349,12 @@ static int amd_mp2_pci_probe(struct pci_dev *pci_dev,
 	if (!privdata)
 		return -ENOMEM;
 
+	privdata->pci_dev = pci_dev;
 	rc = amd_mp2_pci_init(privdata, pci_dev);
 	if (rc)
 		return rc;
 
 	mutex_init(&privdata->c2p_lock);
-	privdata->pci_dev = pci_dev;
 
 	pm_runtime_set_autosuspend_delay(&pci_dev->dev, 1000);
 	pm_runtime_use_autosuspend(&pci_dev->dev);
Signature · 1 line
2.20.1
Applied
#1 lore raw
Quoted 8 lines · Dan Carpenter

The problem is that we dereference "privdata->pci_dev" when we print the error messages in amd_mp2_pci_init():

	dev_err(ndev_dev(privdata), "Failed to enable MP2 PCI device\n");
		^^^^^^^^^^^^^^^^^
Fixes 529766e0a011 ("i2c: Add drivers for the AMD PCIe MP2 I2C controller")

Applied to for-current, thanks!

Elie, Nehal, Shyam, are you still there to review patches for this driver?

maintainer
#2 lore raw

Hi,

Yes I'm still here to review patches.

Sorry about this one, I replied to the v1 but in HTML so it bounced back the ML and should have but didn't give my ack to the v2. I'll make sure to give proper feedback to the latest versions of the patches for the I2C MP2 driver in the future.

Elie

Quoted 16 lines · Wolfram Sang
Quoted 8 lines · Dan Carpenter

The problem is that we dereference "privdata->pci_dev" when we print the error messages in amd_mp2_pci_init():

      dev_err(ndev_dev(privdata), "Failed to enable MP2 PCI device\n");
              ^^^^^^^^^^^^^^^^^
Fixes 529766e0a011 ("i2c: Add drivers for the AMD PCIe MP2 I2C controller")

Applied to for-current, thanks!

Elie, Nehal, Shyam, are you still there to review patches for this driver?

#3 lore raw
Quoted 2 lines

Yes I'm still here to review patches.

Glad to hear that :)

#4 lore raw

Hi wolfram,

Quoted 2 lines · Wolfram Sang
Quoted 1 line

Yes I'm still here to review patches.

Glad to hear that :)

Shyam and myslef also are here to review the patches.

Thanks

Nehal