[2/2] PCI: mt7621: add sentinel to quirks table

Message ID 20221104205242.3440388-3-git@johnthomson.fastmail.com.au
State New
Headers
Series mt7621 pci & phy-pci fix future oops from soc_device_match_attr |

Commit Message

John Thomson Nov. 4, 2022, 8:52 p.m. UTC
  With mt7621 soc_dev_attr fixed to register the soc as a device,
kernel will experience an oops in soc_device_match_attr

This quirk test was introduced in the staging driver in
commit b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision
using 'soc_device_attribute'"), and the staging driver was moved in
commit 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host
controller driver") for the 5.16 kernel

Link: https://lore.kernel.org/lkml/26ebbed1-0fe9-4af9-8466-65f841d0b382@app.fastmail.com
Fixes: b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision
using 'soc_device_attribute'")
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
---
 drivers/pci/controller/pcie-mt7621.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Sergio Paracuellos Nov. 5, 2022, 6:25 a.m. UTC | #1
On Fri, Nov 4, 2022 at 9:54 PM John Thomson
<git@johnthomson.fastmail.com.au> wrote:
>
> With mt7621 soc_dev_attr fixed to register the soc as a device,
> kernel will experience an oops in soc_device_match_attr
>
> This quirk test was introduced in the staging driver in
> commit b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision
> using 'soc_device_attribute'"), and the staging driver was moved in
> commit 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host
> controller driver") for the 5.16 kernel
>
> Link: https://lore.kernel.org/lkml/26ebbed1-0fe9-4af9-8466-65f841d0b382@app.fastmail.com
> Fixes: b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision
> using 'soc_device_attribute'")
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> ---
>  drivers/pci/controller/pcie-mt7621.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Acked-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>

Thanks,
    Sergio Paracuellos
  
John Thomson Nov. 11, 2022, 6:55 p.m. UTC | #2
On Fri, 4 Nov 2022, at 20:52, John Thomson wrote:
> With mt7621 soc_dev_attr fixed to register the soc as a device,
> kernel will experience an oops in soc_device_match_attr
>
> This quirk test was introduced in the staging driver in
> commit b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision
> using 'soc_device_attribute'"), and the staging driver was moved in
> commit 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host
> controller driver") for the 5.16 kernel
>
> Link: 
> https://lore.kernel.org/lkml/26ebbed1-0fe9-4af9-8466-65f841d0b382@app.fastmail.com
> Fixes: b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision
> using 'soc_device_attribute'")
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> ---
>  drivers/pci/controller/pcie-mt7621.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-mt7621.c 
> b/drivers/pci/controller/pcie-mt7621.c
> index 4bd1abf26008..ee7aad09d627 100644
> --- a/drivers/pci/controller/pcie-mt7621.c
> +++ b/drivers/pci/controller/pcie-mt7621.c
> @@ -466,7 +466,8 @@ static int mt7621_pcie_register_host(struct 
> pci_host_bridge *host)
>  }
> 
>  static const struct soc_device_attribute mt7621_pcie_quirks_match[] = {
> -	{ .soc_id = "mt7621", .revision = "E2" }
> +	{ .soc_id = "mt7621", .revision = "E2" },
> +	{ /* sentinel */ }
>  };
> 
>  static int mt7621_pcie_probe(struct platform_device *pdev)
> -- 
> 2.37.2

Ping for the PCI change.
Original link: https://lore.kernel.org/lkml/20221104205242.3440388-3-git@johnthomson.fastmail.com.au/#t
I would like this pci controller patch applied before we fix the MIPS mt7621 early kzalloc boot failure.
The phy-pci patch was accepted.


Cheers,
  
Lorenzo Pieralisi Dec. 5, 2022, 4:26 p.m. UTC | #3
Always capitalize the sentence in the subject.

"PCI: mt7621: Add sentinel to quirks table"

On Sat, Nov 05, 2022 at 06:52:42AM +1000, John Thomson wrote:
> With mt7621 soc_dev_attr fixed to register the soc as a device,
> kernel will experience an oops in soc_device_match_attr

Can we reword this please ? What you are describing *exposes* the
bug but it is not describing the bug per-se.

The bug is related to a missing sentinel in the struct
soc_device_attribute array and that's true regardless of whether it is
actually triggered or not.

Please update the commit log promptly and I shall send it upstream.

Thanks,
Lorenzo

> This quirk test was introduced in the staging driver in
> commit b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision
> using 'soc_device_attribute'"), and the staging driver was moved in
> commit 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host
> controller driver") for the 5.16 kernel
> 
> Link: https://lore.kernel.org/lkml/26ebbed1-0fe9-4af9-8466-65f841d0b382@app.fastmail.com
> Fixes: b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision
> using 'soc_device_attribute'")
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> ---
>  drivers/pci/controller/pcie-mt7621.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
> index 4bd1abf26008..ee7aad09d627 100644
> --- a/drivers/pci/controller/pcie-mt7621.c
> +++ b/drivers/pci/controller/pcie-mt7621.c
> @@ -466,7 +466,8 @@ static int mt7621_pcie_register_host(struct pci_host_bridge *host)
>  }
>  
>  static const struct soc_device_attribute mt7621_pcie_quirks_match[] = {
> -	{ .soc_id = "mt7621", .revision = "E2" }
> +	{ .soc_id = "mt7621", .revision = "E2" },
> +	{ /* sentinel */ }
>  };
>  
>  static int mt7621_pcie_probe(struct platform_device *pdev)
> -- 
> 2.37.2
>
  

Patch

diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
index 4bd1abf26008..ee7aad09d627 100644
--- a/drivers/pci/controller/pcie-mt7621.c
+++ b/drivers/pci/controller/pcie-mt7621.c
@@ -466,7 +466,8 @@  static int mt7621_pcie_register_host(struct pci_host_bridge *host)
 }
 
 static const struct soc_device_attribute mt7621_pcie_quirks_match[] = {
-	{ .soc_id = "mt7621", .revision = "E2" }
+	{ .soc_id = "mt7621", .revision = "E2" },
+	{ /* sentinel */ }
 };
 
 static int mt7621_pcie_probe(struct platform_device *pdev)