2022-02-22 05:55:48

by Yusuf Khan

[permalink] [raw]
Subject: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is not done twice

In the case that the DMA 64 bit bit mask error check does not fail,
the error check will be done twice, this patch fixed that.

NOTE: This patch is only for use in the linux-next branch as the
commit that caused this bug happened there.

Signed-off-by: Yusuf Khan <[email protected]>
---
drivers/fpga/dfl-pci.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index 717ac9715970..6222f18aed4b 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -356,11 +356,12 @@ int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid)
pci_set_master(pcidev);

ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
- if (ret)
- ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
if (ret) {
- dev_err(&pcidev->dev, "No suitable DMA support available.\n");
- goto disable_error_report_exit;
+ ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
+ if (ret) {
+ dev_err(&pcidev->dev, "No suitable DMA support available.\n");
+ goto disable_error_report_exit;
+ }
}

ret = cci_init_drvdata(pcidev);
--
2.25.1


2022-02-22 05:57:09

by Yusuf Khan

[permalink] [raw]
Subject: Re: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is not done twice

Note: This bug was introduced here:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/patch/?id=ada3caabaf6135150077c3f729bb06e8f3b5b8f6
I saw this commit inside the linux-next branch, it is not present in
the mainline branch.
The linux-next branch was last updated 5 days ago, so I am unsure
about the state of that commit.

On Mon, Feb 21, 2022 at 8:27 PM Yusuf Khan <[email protected]> wrote:
>
> In the case that the DMA 64 bit bit mask error check does not fail,
> the error check will be done twice, this patch fixed that.
>
> NOTE: This patch is only for use in the linux-next branch as the
> commit that caused this bug happened there.
>
> Signed-off-by: Yusuf Khan <[email protected]>
> ---
> drivers/fpga/dfl-pci.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> index 717ac9715970..6222f18aed4b 100644
> --- a/drivers/fpga/dfl-pci.c
> +++ b/drivers/fpga/dfl-pci.c
> @@ -356,11 +356,12 @@ int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid)
> pci_set_master(pcidev);
>
> ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
> - if (ret)
> - ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
> if (ret) {
> - dev_err(&pcidev->dev, "No suitable DMA support available.\n");
> - goto disable_error_report_exit;
> + ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
> + if (ret) {
> + dev_err(&pcidev->dev, "No suitable DMA support available.\n");
> + goto disable_error_report_exit;
> + }
> }
>
> ret = cci_init_drvdata(pcidev);
> --
> 2.25.1
>

2022-02-25 16:49:11

by Xu Yilun

[permalink] [raw]
Subject: Re: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is not done twice

On Mon, Feb 21, 2022 at 08:39:48PM -0800, Yusuf Khan wrote:
> Note: This bug was introduced here:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/patch/?id=ada3caabaf6135150077c3f729bb06e8f3b5b8f6
> I saw this commit inside the linux-next branch, it is not present in
> the mainline branch.
> The linux-next branch was last updated 5 days ago, so I am unsure
> about the state of that commit.
>
> On Mon, Feb 21, 2022 at 8:27 PM Yusuf Khan <[email protected]> wrote:
> >
> > In the case that the DMA 64 bit bit mask error check does not fail,
> > the error check will be done twice, this patch fixed that.
> >
> > NOTE: This patch is only for use in the linux-next branch as the
> > commit that caused this bug happened there.
> >
> > Signed-off-by: Yusuf Khan <[email protected]>
> > ---
> > drivers/fpga/dfl-pci.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> > index 717ac9715970..6222f18aed4b 100644
> > --- a/drivers/fpga/dfl-pci.c
> > +++ b/drivers/fpga/dfl-pci.c
> > @@ -356,11 +356,12 @@ int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid)
> > pci_set_master(pcidev);
> >
> > ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
> > - if (ret)
> > - ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
> > if (ret) {
> > - dev_err(&pcidev->dev, "No suitable DMA support available.\n");
> > - goto disable_error_report_exit;
> > + ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
> > + if (ret) {
> > + dev_err(&pcidev->dev, "No suitable DMA support available.\n");
> > + goto disable_error_report_exit;
> > + }

Looks good to me.

Acked-by: Xu Yilun <[email protected]>

> > }
> >
> > ret = cci_init_drvdata(pcidev);
> > --
> > 2.25.1
> >

2022-02-28 13:26:20

by Wu Hao

[permalink] [raw]
Subject: RE: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is not done twice

> On Mon, Feb 21, 2022 at 08:39:48PM -0800, Yusuf Khan wrote:
> > Note: This bug was introduced here:
> > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-
> next.git/patch/?id=ada3caabaf6135150077c3f729bb06e8f3b5b8f6
> > I saw this commit inside the linux-next branch, it is not present in
> > the mainline branch.
> > The linux-next branch was last updated 5 days ago, so I am unsure
> > about the state of that commit.
> >
> > On Mon, Feb 21, 2022 at 8:27 PM Yusuf Khan <[email protected]>
> wrote:
> > >
> > > In the case that the DMA 64 bit bit mask error check does not fail,
> > > the error check will be done twice, this patch fixed that.
> > >
> > > NOTE: This patch is only for use in the linux-next branch as the
> > > commit that caused this bug happened there.

Thanks for the patch.
please remove this from the commit message, and fix the title
s/pga/fpga/

Thanks
Hao

> > >
> > > Signed-off-by: Yusuf Khan <[email protected]>
> > > ---
> > > drivers/fpga/dfl-pci.c | 9 +++++----
> > > 1 file changed, 5 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> > > index 717ac9715970..6222f18aed4b 100644
> > > --- a/drivers/fpga/dfl-pci.c
> > > +++ b/drivers/fpga/dfl-pci.c
> > > @@ -356,11 +356,12 @@ int cci_pci_probe(struct pci_dev *pcidev, const
> struct pci_device_id *pcidevid)
> > > pci_set_master(pcidev);
> > >
> > > ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
> > > - if (ret)
> > > - ret = dma_set_mask_and_coherent(&pcidev->dev,
> DMA_BIT_MASK(32));
> > > if (ret) {
> > > - dev_err(&pcidev->dev, "No suitable DMA support available.\n");
> > > - goto disable_error_report_exit;
> > > + ret = dma_set_mask_and_coherent(&pcidev->dev,
> DMA_BIT_MASK(32));
> > > + if (ret) {
> > > + dev_err(&pcidev->dev, "No suitable DMA support
> available.\n");
> > > + goto disable_error_report_exit;
> > > + }
>
> Looks good to me.
>
> Acked-by: Xu Yilun <[email protected]>
>
> > > }
> > >
> > > ret = cci_init_drvdata(pcidev);
> > > --
> > > 2.25.1
> > >

2022-03-01 03:13:25

by Yusuf Khan

[permalink] [raw]
Subject: Re: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is not done twice

Done. Resent

On Mon, Feb 28, 2022 at 6:34 PM Wu, Hao <[email protected]> wrote:
>
> > -----Original Message-----
> > From: Yusuf Khan <[email protected]>
> > Sent: Tuesday, March 1, 2022 9:59 AM
> > To: Wu, Hao <[email protected]>
> > Cc: Xu, Yilun <[email protected]>; [email protected]; linux-
> > [email protected]; [email protected]; [email protected]
> > Subject: Re: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is
> > not done twice
> >
> > Will do, but I do not know exactly what to remove from the commit message,
> > I understand what to do for the title
>
> > > > > > NOTE: This patch is only for use in the linux-next branch as the
> > > > > > commit that caused this bug happened there.
>
> Remove this NOTE
>
> Hao
>
> >
> > Yusuf
> >
> > On Mon, Feb 28, 2022 at 1:58 AM Wu, Hao <[email protected]> wrote:
> > >
> > > > On Mon, Feb 21, 2022 at 08:39:48PM -0800, Yusuf Khan wrote:
> > > > > Note: This bug was introduced here:
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-
> > > > next.git/patch/?id=ada3caabaf6135150077c3f729bb06e8f3b5b8f6
> > > > > I saw this commit inside the linux-next branch, it is not present in
> > > > > the mainline branch.
> > > > > The linux-next branch was last updated 5 days ago, so I am unsure
> > > > > about the state of that commit.
> > > > >
> > > > > On Mon, Feb 21, 2022 at 8:27 PM Yusuf Khan <[email protected]>
> > > > wrote:
> > > > > >
> > > > > > In the case that the DMA 64 bit bit mask error check does not fail,
> > > > > > the error check will be done twice, this patch fixed that.
> > > > > >
> > > > > > NOTE: This patch is only for use in the linux-next branch as the
> > > > > > commit that caused this bug happened there.
> > >
> > > Thanks for the patch.
> > > please remove this from the commit message, and fix the title
> > > s/pga/fpga/
> > >
> > > Thanks
> > > Hao
> > >
> > > > > >
> > > > > > Signed-off-by: Yusuf Khan <[email protected]>
> > > > > > ---
> > > > > > drivers/fpga/dfl-pci.c | 9 +++++----
> > > > > > 1 file changed, 5 insertions(+), 4 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> > > > > > index 717ac9715970..6222f18aed4b 100644
> > > > > > --- a/drivers/fpga/dfl-pci.c
> > > > > > +++ b/drivers/fpga/dfl-pci.c
> > > > > > @@ -356,11 +356,12 @@ int cci_pci_probe(struct pci_dev *pcidev, const
> > > > struct pci_device_id *pcidevid)
> > > > > > pci_set_master(pcidev);
> > > > > >
> > > > > > ret = dma_set_mask_and_coherent(&pcidev->dev,
> > DMA_BIT_MASK(64));
> > > > > > - if (ret)
> > > > > > - ret = dma_set_mask_and_coherent(&pcidev->dev,
> > > > DMA_BIT_MASK(32));
> > > > > > if (ret) {
> > > > > > - dev_err(&pcidev->dev, "No suitable DMA support available.\n");
> > > > > > - goto disable_error_report_exit;
> > > > > > + ret = dma_set_mask_and_coherent(&pcidev->dev,
> > > > DMA_BIT_MASK(32));
> > > > > > + if (ret) {
> > > > > > + dev_err(&pcidev->dev, "No suitable DMA support
> > > > available.\n");
> > > > > > + goto disable_error_report_exit;
> > > > > > + }
> > > >
> > > > Looks good to me.
> > > >
> > > > Acked-by: Xu Yilun <[email protected]>
> > > >
> > > > > > }
> > > > > >
> > > > > > ret = cci_init_drvdata(pcidev);
> > > > > > --
> > > > > > 2.25.1
> > > > > >

2022-03-01 04:20:38

by Wu Hao

[permalink] [raw]
Subject: RE: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is not done twice

> -----Original Message-----
> From: Yusuf Khan <[email protected]>
> Sent: Tuesday, March 1, 2022 9:59 AM
> To: Wu, Hao <[email protected]>
> Cc: Xu, Yilun <[email protected]>; [email protected]; linux-
> [email protected]; [email protected]; [email protected]
> Subject: Re: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is
> not done twice
>
> Will do, but I do not know exactly what to remove from the commit message,
> I understand what to do for the title

> > > > > NOTE: This patch is only for use in the linux-next branch as the
> > > > > commit that caused this bug happened there.

Remove this NOTE

Hao

>
> Yusuf
>
> On Mon, Feb 28, 2022 at 1:58 AM Wu, Hao <[email protected]> wrote:
> >
> > > On Mon, Feb 21, 2022 at 08:39:48PM -0800, Yusuf Khan wrote:
> > > > Note: This bug was introduced here:
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-
> > > next.git/patch/?id=ada3caabaf6135150077c3f729bb06e8f3b5b8f6
> > > > I saw this commit inside the linux-next branch, it is not present in
> > > > the mainline branch.
> > > > The linux-next branch was last updated 5 days ago, so I am unsure
> > > > about the state of that commit.
> > > >
> > > > On Mon, Feb 21, 2022 at 8:27 PM Yusuf Khan <[email protected]>
> > > wrote:
> > > > >
> > > > > In the case that the DMA 64 bit bit mask error check does not fail,
> > > > > the error check will be done twice, this patch fixed that.
> > > > >
> > > > > NOTE: This patch is only for use in the linux-next branch as the
> > > > > commit that caused this bug happened there.
> >
> > Thanks for the patch.
> > please remove this from the commit message, and fix the title
> > s/pga/fpga/
> >
> > Thanks
> > Hao
> >
> > > > >
> > > > > Signed-off-by: Yusuf Khan <[email protected]>
> > > > > ---
> > > > > drivers/fpga/dfl-pci.c | 9 +++++----
> > > > > 1 file changed, 5 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> > > > > index 717ac9715970..6222f18aed4b 100644
> > > > > --- a/drivers/fpga/dfl-pci.c
> > > > > +++ b/drivers/fpga/dfl-pci.c
> > > > > @@ -356,11 +356,12 @@ int cci_pci_probe(struct pci_dev *pcidev, const
> > > struct pci_device_id *pcidevid)
> > > > > pci_set_master(pcidev);
> > > > >
> > > > > ret = dma_set_mask_and_coherent(&pcidev->dev,
> DMA_BIT_MASK(64));
> > > > > - if (ret)
> > > > > - ret = dma_set_mask_and_coherent(&pcidev->dev,
> > > DMA_BIT_MASK(32));
> > > > > if (ret) {
> > > > > - dev_err(&pcidev->dev, "No suitable DMA support available.\n");
> > > > > - goto disable_error_report_exit;
> > > > > + ret = dma_set_mask_and_coherent(&pcidev->dev,
> > > DMA_BIT_MASK(32));
> > > > > + if (ret) {
> > > > > + dev_err(&pcidev->dev, "No suitable DMA support
> > > available.\n");
> > > > > + goto disable_error_report_exit;
> > > > > + }
> > >
> > > Looks good to me.
> > >
> > > Acked-by: Xu Yilun <[email protected]>
> > >
> > > > > }
> > > > >
> > > > > ret = cci_init_drvdata(pcidev);
> > > > > --
> > > > > 2.25.1
> > > > >

2022-03-01 06:58:29

by Yusuf Khan

[permalink] [raw]
Subject: Re: [PATCH -next] pga: dfl: pci: Make sure DMA related error check is not done twice

Will do, but I do not know exactly what to remove from the commit message,
I understand what to do for the title

Yusuf

On Mon, Feb 28, 2022 at 1:58 AM Wu, Hao <[email protected]> wrote:
>
> > On Mon, Feb 21, 2022 at 08:39:48PM -0800, Yusuf Khan wrote:
> > > Note: This bug was introduced here:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-
> > next.git/patch/?id=ada3caabaf6135150077c3f729bb06e8f3b5b8f6
> > > I saw this commit inside the linux-next branch, it is not present in
> > > the mainline branch.
> > > The linux-next branch was last updated 5 days ago, so I am unsure
> > > about the state of that commit.
> > >
> > > On Mon, Feb 21, 2022 at 8:27 PM Yusuf Khan <[email protected]>
> > wrote:
> > > >
> > > > In the case that the DMA 64 bit bit mask error check does not fail,
> > > > the error check will be done twice, this patch fixed that.
> > > >
> > > > NOTE: This patch is only for use in the linux-next branch as the
> > > > commit that caused this bug happened there.
>
> Thanks for the patch.
> please remove this from the commit message, and fix the title
> s/pga/fpga/
>
> Thanks
> Hao
>
> > > >
> > > > Signed-off-by: Yusuf Khan <[email protected]>
> > > > ---
> > > > drivers/fpga/dfl-pci.c | 9 +++++----
> > > > 1 file changed, 5 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> > > > index 717ac9715970..6222f18aed4b 100644
> > > > --- a/drivers/fpga/dfl-pci.c
> > > > +++ b/drivers/fpga/dfl-pci.c
> > > > @@ -356,11 +356,12 @@ int cci_pci_probe(struct pci_dev *pcidev, const
> > struct pci_device_id *pcidevid)
> > > > pci_set_master(pcidev);
> > > >
> > > > ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
> > > > - if (ret)
> > > > - ret = dma_set_mask_and_coherent(&pcidev->dev,
> > DMA_BIT_MASK(32));
> > > > if (ret) {
> > > > - dev_err(&pcidev->dev, "No suitable DMA support available.\n");
> > > > - goto disable_error_report_exit;
> > > > + ret = dma_set_mask_and_coherent(&pcidev->dev,
> > DMA_BIT_MASK(32));
> > > > + if (ret) {
> > > > + dev_err(&pcidev->dev, "No suitable DMA support
> > available.\n");
> > > > + goto disable_error_report_exit;
> > > > + }
> >
> > Looks good to me.
> >
> > Acked-by: Xu Yilun <[email protected]>
> >
> > > > }
> > > >
> > > > ret = cci_init_drvdata(pcidev);
> > > > --
> > > > 2.25.1
> > > >