diff mbox series

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

Message ID 20190910134242.GA6620@mwanda
State Accepted
Headers show
Series [v2] i2c: i2c-amd-mp2-pci: Fix Oops in amd_mp2_pci_init() error handling | expand

Commit Message

Dan Carpenter Sept. 10, 2019, 1:42 p.m. UTC
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: style change

 drivers/i2c/busses/i2c-amd-mp2-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wolfram Sang April 30, 2020, 2:10 p.m. UTC | #1
On Tue, Sep 10, 2019 at 04:42:42PM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to for-current, thanks!

Elie, Nehal, Shyam, are you still there to review patches for this
driver?
Elie Morisse April 30, 2020, 7:43 p.m. UTC | #2
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

Le jeu. 30 avr. 2020 à 11:10, Wolfram Sang <wsa@the-dreams.de> a écrit :
>
> On Tue, Sep 10, 2019 at 04:42:42PM +0300, Dan Carpenter wrote:
> > 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")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Applied to for-current, thanks!
>
> Elie, Nehal, Shyam, are you still there to review patches for this
> driver?
>
Wolfram Sang April 30, 2020, 8:06 p.m. UTC | #3
> Yes I'm still here to review patches.

Glad to hear that :)
Shah, Nehal-bakulchandra May 1, 2020, 5:10 a.m. UTC | #4
Hi wolfram,

On 5/1/2020 1:36 AM, Wolfram Sang wrote:
>> Yes I'm still here to review patches.
> Glad to hear that :)

Shyam and myslef also are here to review the patches.

Thanks

Nehal
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-amd-mp2-pci.c b/drivers/i2c/busses/i2c-amd-mp2-pci.c
index 5e4800d72e00..cd3fd5ee5f65 100644
--- a/drivers/i2c/busses/i2c-amd-mp2-pci.c
+++ b/drivers/i2c/busses/i2c-amd-mp2-pci.c
@@ -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);