linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Li Yang <leoyang.li@nxp.com>
To: Zhiqiang Hou <Zhiqiang.Hou@nxp.com>, Bjorn Helgaas <bhelgaas@google.com>
Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Roy Zang <roy.zang@nxp.com>,
	linux-pci@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>,
	Minghuan Lian <minghuan.Lian@nxp.com>,
	Rob Herring <robh+dt@kernel.org>, Mingkai Hu <mingkai.hu@nxp.com>,
	gustavo.pimentel@synopsys.com, Shawn Guo <shawnguo@kernel.org>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCHv3 1/7] PCI: dwc: Fix a bug of the case dw_pci->ops is NULL
Date: Thu, 28 Jan 2021 17:22:02 -0600	[thread overview]
Message-ID: <CADRPPNQr4xGH0On94rxr69VYeZAQEYQgt=CosVqEDi91cfO_tw@mail.gmail.com> (raw)
In-Reply-To: <20210108093610.28595-2-Zhiqiang.Hou@nxp.com>

On Fri, Jan 8, 2021 at 3:29 AM Zhiqiang Hou <Zhiqiang.Hou@nxp.com> wrote:
>
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>
> The dw_pci->ops may be a NULL, and fix it by adding one more check.
>
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>

Hi Bjorn,

This is causing many layerscape platforms to fail to boot.  Can you
help to pick up this patch?  Or are you actually preferring other
solutions like creating dummy ops when it is not needed?

Regards,
Leo

> ---
> V3:
>  - Rebased against the latest code base
>
>  drivers/pci/controller/dwc/pcie-designware-host.c |  2 +-
>  drivers/pci/controller/dwc/pcie-designware.c      | 14 +++++++-------
>  2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 516b151e0ef3..0413284fdd93 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -429,7 +429,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
>         dw_pcie_setup_rc(pp);
>         dw_pcie_msi_init(pp);
>
> -       if (!dw_pcie_link_up(pci) && pci->ops->start_link) {
> +       if (!dw_pcie_link_up(pci) && pci->ops && pci->ops->start_link) {
>                 ret = pci->ops->start_link(pci);
>                 if (ret)
>                         goto err_free_msi;
> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> index 645fa1892375..cf895c12f71f 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.c
> +++ b/drivers/pci/controller/dwc/pcie-designware.c
> @@ -141,7 +141,7 @@ u32 dw_pcie_read_dbi(struct dw_pcie *pci, u32 reg, size_t size)
>         int ret;
>         u32 val;
>
> -       if (pci->ops->read_dbi)
> +       if (pci->ops && pci->ops->read_dbi)
>                 return pci->ops->read_dbi(pci, pci->dbi_base, reg, size);
>
>         ret = dw_pcie_read(pci->dbi_base + reg, size, &val);
> @@ -156,7 +156,7 @@ void dw_pcie_write_dbi(struct dw_pcie *pci, u32 reg, size_t size, u32 val)
>  {
>         int ret;
>
> -       if (pci->ops->write_dbi) {
> +       if (pci->ops && pci->ops->write_dbi) {
>                 pci->ops->write_dbi(pci, pci->dbi_base, reg, size, val);
>                 return;
>         }
> @@ -171,7 +171,7 @@ void dw_pcie_write_dbi2(struct dw_pcie *pci, u32 reg, size_t size, u32 val)
>  {
>         int ret;
>
> -       if (pci->ops->write_dbi2) {
> +       if (pci->ops && pci->ops->write_dbi2) {
>                 pci->ops->write_dbi2(pci, pci->dbi_base2, reg, size, val);
>                 return;
>         }
> @@ -186,7 +186,7 @@ static u32 dw_pcie_readl_atu(struct dw_pcie *pci, u32 reg)
>         int ret;
>         u32 val;
>
> -       if (pci->ops->read_dbi)
> +       if (pci->ops && pci->ops->read_dbi)
>                 return pci->ops->read_dbi(pci, pci->atu_base, reg, 4);
>
>         ret = dw_pcie_read(pci->atu_base + reg, 4, &val);
> @@ -200,7 +200,7 @@ static void dw_pcie_writel_atu(struct dw_pcie *pci, u32 reg, u32 val)
>  {
>         int ret;
>
> -       if (pci->ops->write_dbi) {
> +       if (pci->ops && pci->ops->write_dbi) {
>                 pci->ops->write_dbi(pci, pci->atu_base, reg, 4, val);
>                 return;
>         }
> @@ -273,7 +273,7 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no,
>  {
>         u32 retries, val;
>
> -       if (pci->ops->cpu_addr_fixup)
> +       if (pci->ops && pci->ops->cpu_addr_fixup)
>                 cpu_addr = pci->ops->cpu_addr_fixup(pci, cpu_addr);
>
>         if (pci->iatu_unroll_enabled) {
> @@ -481,7 +481,7 @@ int dw_pcie_link_up(struct dw_pcie *pci)
>  {
>         u32 val;
>
> -       if (pci->ops->link_up)
> +       if (pci->ops && pci->ops->link_up)
>                 return pci->ops->link_up(pci);
>
>         val = readl(pci->dbi_base + PCIE_PORT_DEBUG1);
> --
> 2.17.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-01-28 23:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08  9:36 [PATCHv3 0/7] PCI: layerscape: Add power management support Zhiqiang Hou
2021-01-08  9:36 ` [PATCHv3 1/7] PCI: dwc: Fix a bug of the case dw_pci->ops is NULL Zhiqiang Hou
2021-01-28 23:22   ` Li Yang [this message]
2021-01-08  9:36 ` [PATCHv3 2/7] PCI: layerscape: Change to use the DWC common link-up check function Zhiqiang Hou
2021-01-08  9:36 ` [PATCHv3 3/7] dt-bindings: pci: layerscape-pci: Add a optional property big-endian Zhiqiang Hou
2021-01-08  9:36 ` [PATCHv3 4/7] arm64: dts: layerscape: Add big-endian property for PCIe nodes Zhiqiang Hou
2021-01-08  9:36 ` [PATCHv3 5/7] dt-bindings: pci: layerscape-pci: Update the description of SCFG property Zhiqiang Hou
2021-01-08  9:36 ` [PATCHv3 6/7] arm64: dts: ls1043a: Add SCFG phandle for PCIe nodes Zhiqiang Hou
2021-01-08  9:36 ` [PATCHv3 7/7] PCI: layerscape: Add power management support Zhiqiang Hou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADRPPNQr4xGH0On94rxr69VYeZAQEYQgt=CosVqEDi91cfO_tw@mail.gmail.com' \
    --to=leoyang.li@nxp.com \
    --cc=Zhiqiang.Hou@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=minghuan.Lian@nxp.com \
    --cc=mingkai.hu@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=roy.zang@nxp.com \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).