2020-11-06 09:45:45

by 王擎

[permalink] [raw]
Subject: [PATCH] ntb: idt: fix error check in ntb_hw_idt.c

idt_create_dev never return NULL and fix smatch warning.

Signed-off-by: Wang Qing <[email protected]>
---
drivers/ntb/hw/idt/ntb_hw_idt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.c b/drivers/ntb/hw/idt/ntb_hw_idt.c
index d54261f..e7a4c2a
--- a/drivers/ntb/hw/idt/ntb_hw_idt.c
+++ b/drivers/ntb/hw/idt/ntb_hw_idt.c
@@ -2511,7 +2511,7 @@ static int idt_init_dbgfs(struct idt_ntb_dev *ndev)
/* If the top directory is not created then do nothing */
if (IS_ERR_OR_NULL(dbgfs_topdir)) {
dev_info(&ndev->ntb.pdev->dev, "Top DebugFS directory absent");
- return PTR_ERR(dbgfs_topdir);
+ return PTR_ERR_OR_ZERO(dbgfs_topdir);
}

/* Create the info file node */
@@ -2756,7 +2756,7 @@ static int idt_pci_probe(struct pci_dev *pdev,

/* Allocate the memory for IDT NTB device data */
ndev = idt_create_dev(pdev, id);
- if (IS_ERR_OR_NULL(ndev))
+ if (IS_ERR(ndev))
return PTR_ERR(ndev);

/* Initialize the basic PCI subsystem of the device */
--
2.7.4


2020-11-10 18:37:29

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH] ntb: idt: fix error check in ntb_hw_idt.c

Hello Wang

On Fri, Nov 06, 2020 at 05:43:31PM +0800, Wang Qing wrote:
> idt_create_dev never return NULL and fix smatch warning.

Thanks for submitting this. For the both changes
Acked-by: Serge Semin <[email protected]>

They are mostly unrelated though. If they weren't trivial I'd have
suggested to split them up into the dedicated patches. Since they
aren't I suppose leaving the patch 'as is' is ok, unless the subsystem
maintainer thinks differently.

-Sergey

>
> Signed-off-by: Wang Qing <[email protected]>
> ---
> drivers/ntb/hw/idt/ntb_hw_idt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.c b/drivers/ntb/hw/idt/ntb_hw_idt.c
> index d54261f..e7a4c2a
> --- a/drivers/ntb/hw/idt/ntb_hw_idt.c
> +++ b/drivers/ntb/hw/idt/ntb_hw_idt.c
> @@ -2511,7 +2511,7 @@ static int idt_init_dbgfs(struct idt_ntb_dev *ndev)
> /* If the top directory is not created then do nothing */
> if (IS_ERR_OR_NULL(dbgfs_topdir)) {
> dev_info(&ndev->ntb.pdev->dev, "Top DebugFS directory absent");
> - return PTR_ERR(dbgfs_topdir);
> + return PTR_ERR_OR_ZERO(dbgfs_topdir);
> }
>
> /* Create the info file node */
> @@ -2756,7 +2756,7 @@ static int idt_pci_probe(struct pci_dev *pdev,
>
> /* Allocate the memory for IDT NTB device data */
> ndev = idt_create_dev(pdev, id);
> - if (IS_ERR_OR_NULL(ndev))
> + if (IS_ERR(ndev))
> return PTR_ERR(ndev);
>
> /* Initialize the basic PCI subsystem of the device */
> --
> 2.7.4
>

2020-12-06 23:31:23

by Jon Mason

[permalink] [raw]
Subject: Re: [PATCH] ntb: idt: fix error check in ntb_hw_idt.c

On Tue, Nov 10, 2020 at 09:33:40PM +0300, Serge Semin wrote:
> Hello Wang
>
> On Fri, Nov 06, 2020 at 05:43:31PM +0800, Wang Qing wrote:
> > idt_create_dev never return NULL and fix smatch warning.
>
> Thanks for submitting this. For the both changes
> Acked-by: Serge Semin <[email protected]>

Applied to the ntb branch.

Thanks,
Jon

>
> They are mostly unrelated though. If they weren't trivial I'd have
> suggested to split them up into the dedicated patches. Since they
> aren't I suppose leaving the patch 'as is' is ok, unless the subsystem
> maintainer thinks differently.
>
> -Sergey
>
> >
> > Signed-off-by: Wang Qing <[email protected]>
> > ---
> > drivers/ntb/hw/idt/ntb_hw_idt.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.c b/drivers/ntb/hw/idt/ntb_hw_idt.c
> > index d54261f..e7a4c2a
> > --- a/drivers/ntb/hw/idt/ntb_hw_idt.c
> > +++ b/drivers/ntb/hw/idt/ntb_hw_idt.c
> > @@ -2511,7 +2511,7 @@ static int idt_init_dbgfs(struct idt_ntb_dev *ndev)
> > /* If the top directory is not created then do nothing */
> > if (IS_ERR_OR_NULL(dbgfs_topdir)) {
> > dev_info(&ndev->ntb.pdev->dev, "Top DebugFS directory absent");
> > - return PTR_ERR(dbgfs_topdir);
> > + return PTR_ERR_OR_ZERO(dbgfs_topdir);
> > }
> >
> > /* Create the info file node */
> > @@ -2756,7 +2756,7 @@ static int idt_pci_probe(struct pci_dev *pdev,
> >
> > /* Allocate the memory for IDT NTB device data */
> > ndev = idt_create_dev(pdev, id);
> > - if (IS_ERR_OR_NULL(ndev))
> > + if (IS_ERR(ndev))
> > return PTR_ERR(ndev);
> >
> > /* Initialize the basic PCI subsystem of the device */
> > --
> > 2.7.4
> >