diff mbox series

[v3] PCI: mediatek: Configure FC and FTS for functions other than 0

Message ID c529dbfc066f4bda9b87edbdbf771f207e69b84e.1604510053.git.ryder.lee@mediatek.com (mailing list archive)
State Accepted, archived
Delegated to: Lorenzo Pieralisi
Headers show
Series [v3] PCI: mediatek: Configure FC and FTS for functions other than 0 | expand

Commit Message

Ryder Lee Nov. 4, 2020, 8:58 p.m. UTC
PCI_FUNC(port->slot << 3)" is always 0, so previously
mtk_pcie_startup_port() only configured FC credits and FTs for
function 0.

Compute "func" correctly so we also configure functions other than
0. This affects MT2701 and MT7623.

Addresses-Coverity-ID: 1437218 ("Wrong operator used")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
v2 & v3 - update commit log
---
 drivers/pci/controller/pcie-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Frank Wunderlich Nov. 5, 2020, 6:22 p.m. UTC | #1
How can i verify (triggering bug without patch)?
regards Frank
Krzysztof Wilczyński Feb. 21, 2021, 7:29 p.m. UTC | #2
[+cc Lorenzo for visiblity]

Hi,

Thank you for taking care of this!

[...]
> PCI_FUNC(port->slot << 3)" is always 0, so previously
> mtk_pcie_startup_port() only configured FC credits and FTs for
> function 0.
[...]

A small nit.  The commit message is missing the opening quote, see
Bjorn's suggestion:

  https://lore.kernel.org/linux-pci/20201104131054.GA307984@bjorn-Precision-5520/

But, it's probably not worth sending another patch, and perhaps either
Bjorn or Lorenzo could fix this when applying changes.

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Krzysztof
Lorenzo Pieralisi March 26, 2021, 3:51 p.m. UTC | #3
On Sun, Feb 21, 2021 at 08:29:02PM +0100, Krzysztof Wilczyński wrote:
> [+cc Lorenzo for visiblity]
> 
> Hi,
> 
> Thank you for taking care of this!
> 
> [...]
> > PCI_FUNC(port->slot << 3)" is always 0, so previously
> > mtk_pcie_startup_port() only configured FC credits and FTs for
> > function 0.
> [...]
> 
> A small nit.  The commit message is missing the opening quote, see
> Bjorn's suggestion:
> 
>   https://lore.kernel.org/linux-pci/20201104131054.GA307984@bjorn-Precision-5520/
> 
> But, it's probably not worth sending another patch, and perhaps either
> Bjorn or Lorenzo could fix this when applying changes.
> 
> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Thanks, I will do. Can I apply it or there are still pending review
comments to address ?

Lorenzo
Krzysztof Wilczyński March 26, 2021, 11:53 p.m. UTC | #4
Hi Lorenzo,

[...]
> > A small nit.  The commit message is missing the opening quote, see
> > Bjorn's suggestion:
> > 
> >   https://lore.kernel.org/linux-pci/20201104131054.GA307984@bjorn-Precision-5520/
> > 
> > But, it's probably not worth sending another patch, and perhaps either
> > Bjorn or Lorenzo could fix this when applying changes.
> > 
> > Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
> 
> Thanks, I will do. Can I apply it or there are still pending review
> comments to address ?

Nothing from me, so it's good to go, I'd say.  Thank you!

Krzysztof
Lorenzo Pieralisi March 29, 2021, 3:03 p.m. UTC | #5
On Thu, 5 Nov 2020 04:58:33 +0800, Ryder Lee wrote:
> PCI_FUNC(port->slot << 3)" is always 0, so previously
> mtk_pcie_startup_port() only configured FC credits and FTs for
> function 0.
> 
> Compute "func" correctly so we also configure functions other than
> 0. This affects MT2701 and MT7623.

Applied to pci/mediatek, thanks!

[1/1] PCI: mediatek: Configure FC and FTS for functions other than 0
      https://git.kernel.org/lpieralisi/pci/c/31ec9c2746

Thanks,
Lorenzo
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index cf4c18f0c25a..1980b01cee35 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -760,7 +760,7 @@  static struct pci_ops mtk_pcie_ops = {
 static int mtk_pcie_startup_port(struct mtk_pcie_port *port)
 {
 	struct mtk_pcie *pcie = port->pcie;
-	u32 func = PCI_FUNC(port->slot << 3);
+	u32 func = PCI_FUNC(port->slot);
 	u32 slot = PCI_SLOT(port->slot << 3);
 	u32 val;
 	int err;