diff mbox series

[-next] PCI: brcmstb: Fix missing mutex_init()

Message ID 20200119023003.100987-1-weiyongjun1@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Lorenzo Pieralisi
Headers show
Series [-next] PCI: brcmstb: Fix missing mutex_init() | expand

Commit Message

Wei Yongjun Jan. 19, 2020, 2:30 a.m. UTC
The driver allocates the mutex but not initialize it.
Use mutex_init() on it to initialize it correctly.

This is detected by Coccinelle semantic patch.

Fixes: 72af6f6f0d13 ("PCI: brcmstb: Add MSI support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/pci/controller/pcie-brcmstb.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Florian Fainelli Jan. 19, 2020, 5:50 p.m. UTC | #1
On 1/18/2020 6:30 PM, Wei Yongjun wrote:
> The driver allocates the mutex but not initialize it.
> Use mutex_init() on it to initialize it correctly.
> 
> This is detected by Coccinelle semantic patch.
> 
> Fixes: 72af6f6f0d13 ("PCI: brcmstb: Add MSI support")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Lorenzo Pieralisi Jan. 20, 2020, 10:54 a.m. UTC | #2
On Sun, Jan 19, 2020 at 09:50:09AM -0800, Florian Fainelli wrote:
> 
> 
> On 1/18/2020 6:30 PM, Wei Yongjun wrote:
> > The driver allocates the mutex but not initialize it.
> > Use mutex_init() on it to initialize it correctly.
> > 
> > This is detected by Coccinelle semantic patch.
> > 
> > Fixes: 72af6f6f0d13 ("PCI: brcmstb: Add MSI support")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

I have squashed it in in my pci/brcmstb branch, thanks.

Lorenzo
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 43cba76c0e1e..065bada9cfad 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -528,6 +528,7 @@  static int brcm_pcie_enable_msi(struct brcm_pcie *pcie)
 	if (!msi)
 		return -ENOMEM;
 
+	mutex_init(&msi->lock);
 	msi->dev = dev;
 	msi->base = pcie->base;
 	msi->np = pcie->np;