diff mbox

[Quantal/Raring,1/2] MFD: rtsx_pcr: Fix probe fail path

Message ID 1373879318-31298-1-git-send-email-adam.lee@canonical.com
State New
Headers show

Commit Message

Adam Lee July 15, 2013, 9:08 a.m. UTC
From: Jiri Slaby <jslaby@suse.cz>

BugLink: http://bugs.launchpad.net/bugs/1201321

When rtsx_pci_acquire_irq fails in rtsx_pci_probe, we forget to
disable an MSI (if we enabled it). This results in this warning on the
next attempt to load the module:
WARNING: at drivers/pci/msi.c:834 pci_enable_msi_block+0x2a4/0x2b0()
Hardware name: HP EliteBook 840 G1
Modules linked in: rtsx_pci(+) ...
Pid: 4056, comm: modprobe Tainted: G          I  3.8.0-9405-gd895cb1-1-vanilla #1
Call Trace:
 [<ffffffff81045c6a>] warn_slowpath_common+0x7a/0xc0
 [<ffffffff81045cc5>] warn_slowpath_null+0x15/0x20
 [<ffffffff81302544>] pci_enable_msi_block+0x2a4/0x2b0
 [<ffffffffa05e335a>] rtsx_pci_probe+0x55a/0x720 [rtsx_pci]
...

So properly disable MSI in that case.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
(cherry picked from commit 9d66b568a215fe2da2a9db736ebf9b8d66082d88)
Signed-off-by: Adam Lee <adam.lee@canonical.com>
---
 drivers/mfd/rtsx_pcr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tim Gardner July 15, 2013, 12:51 p.m. UTC | #1

Brad Figg July 15, 2013, 2:38 p.m. UTC | #2
On 07/15/2013 02:08 AM, Adam Lee wrote:
> From: Jiri Slaby <jslaby@suse.cz>
> 
> BugLink: http://bugs.launchpad.net/bugs/1201321
> 
> When rtsx_pci_acquire_irq fails in rtsx_pci_probe, we forget to
> disable an MSI (if we enabled it). This results in this warning on the
> next attempt to load the module:
> WARNING: at drivers/pci/msi.c:834 pci_enable_msi_block+0x2a4/0x2b0()
> Hardware name: HP EliteBook 840 G1
> Modules linked in: rtsx_pci(+) ...
> Pid: 4056, comm: modprobe Tainted: G          I  3.8.0-9405-gd895cb1-1-vanilla #1
> Call Trace:
>  [<ffffffff81045c6a>] warn_slowpath_common+0x7a/0xc0
>  [<ffffffff81045cc5>] warn_slowpath_null+0x15/0x20
>  [<ffffffff81302544>] pci_enable_msi_block+0x2a4/0x2b0
>  [<ffffffffa05e335a>] rtsx_pci_probe+0x55a/0x720 [rtsx_pci]
> ...
> 
> So properly disable MSI in that case.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
> (cherry picked from commit 9d66b568a215fe2da2a9db736ebf9b8d66082d88)
> Signed-off-by: Adam Lee <adam.lee@canonical.com>
> ---
>  drivers/mfd/rtsx_pcr.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
> index 5f4df5a4..81387d4 100644
> --- a/drivers/mfd/rtsx_pcr.c
> +++ b/drivers/mfd/rtsx_pcr.c
> @@ -1141,7 +1141,7 @@ static int __devinit rtsx_pci_probe(struct pci_dev *pcidev,
>  
>  	ret = rtsx_pci_acquire_irq(pcr);
>  	if (ret < 0)
> -		goto free_dma;
> +		goto disable_msi;
>  
>  	pci_set_master(pcidev);
>  	synchronize_irq(pcr->irq);
> @@ -1165,7 +1165,9 @@ static int __devinit rtsx_pci_probe(struct pci_dev *pcidev,
>  
>  disable_irq:
>  	free_irq(pcr->irq, (void *)pcr);
> -free_dma:
> +disable_msi:
> +	if (pcr->msi_en)
> +		pci_disable_msi(pcr->pci);
>  	dma_free_coherent(&(pcr->pci->dev), RTSX_RESV_BUF_LEN,
>  			pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr);
>  unmap:
>
Tim Gardner July 15, 2013, 7:23 p.m. UTC | #3
Seems like a good candidate for stable.
Kamal Mostafa July 16, 2013, 11:13 p.m. UTC | #4
On Mon, 2013-07-15 at 13:23 -0600, Tim Gardner wrote:
> Seems like a good candidate for stable.
> 
> 

Thanks Tim... I've queued it up for 3.8.13.5:

        commit c9f2cf9fec5687d6fc13c99f0e073112b4a5ea84
        Author: Jiri Slaby <jslaby@suse.cz>
        Date:   Thu Apr 4 21:34:11 2013 +0200
        
            MFD: rtsx_pcr: Fix probe fail path
            
            commit 9d66b568a215fe2da2a9db736ebf9b8d66082d88 upstream.


 -Kamal
Luis Henriques July 23, 2013, 9:57 a.m. UTC | #5
Tim Gardner <tim.gardner@canonical.com> writes:

> Seems like a good candidate for stable.

[ Sorry for the delay in my reply. ]

I see Kamal has already queued this patch for 3.8.y.  Since the
affected driver seems to have been merged during the 3.7 kernel
development cycle, it doesn't apply to 3.5.y stable.

Cheers,
diff mbox

Patch

diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 5f4df5a4..81387d4 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -1141,7 +1141,7 @@  static int __devinit rtsx_pci_probe(struct pci_dev *pcidev,
 
 	ret = rtsx_pci_acquire_irq(pcr);
 	if (ret < 0)
-		goto free_dma;
+		goto disable_msi;
 
 	pci_set_master(pcidev);
 	synchronize_irq(pcr->irq);
@@ -1165,7 +1165,9 @@  static int __devinit rtsx_pci_probe(struct pci_dev *pcidev,
 
 disable_irq:
 	free_irq(pcr->irq, (void *)pcr);
-free_dma:
+disable_msi:
+	if (pcr->msi_en)
+		pci_disable_msi(pcr->pci);
 	dma_free_coherent(&(pcr->pci->dev), RTSX_RESV_BUF_LEN,
 			pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr);
 unmap: