mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sparc: kernel: add missing put_device()
       [not found] <20230718072514.16432-1-xujianghui@cdjrlc.com>
@ 2023-07-18  7:26 ` sunran001
  2023-07-18 15:02   ` Sam Ravnborg
  0 siblings, 1 reply; 2+ messages in thread
From: sunran001 @ 2023-07-18  7:26 UTC (permalink / raw)
  To: davem; +Cc: sparclinux, linux-kernel

The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.

Detected by coccinelle with the following ERRORS:
./arch/sparc/kernel/pci_psycho.c:308:2-8: ERROR: missing put_device;
call of_find_device_by_node on line 290, but without a corresponding
object release within this function.
./arch/sparc/kernel/pci_psycho.c:350:0-1: ERROR: missing put_device;
call of_find_device_by_node on line 290, but without a corresponding
object release within this function.

Signed-off-by: Ran Sun <sunran001@208suo.com>
---
  arch/sparc/kernel/pci_psycho.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/arch/sparc/kernel/pci_psycho.c 
b/arch/sparc/kernel/pci_psycho.c
index f413371da387..45f8370bbfad 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -305,6 +305,7 @@ static void psycho_register_error_handlers(struct 
pci_pbm_info *pbm)
       */

      if (op->archdata.num_irqs < 6)
+        put_device(op->dev);
          return;

      /* We really mean to ignore the return result here.  Two
@@ -347,6 +348,7 @@ static void psycho_register_error_handlers(struct 
pci_pbm_info *pbm)
          PSYCHO_PCICTRL_EEN);
      tmp &= ~(PSYCHO_PCICTRL_SBH_INT);
      upa_writeq(tmp, base + PSYCHO_PCIB_CTRL);
+    put_device(op->dev);
  }

  /* PSYCHO boot time probing and initialization. */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sparc: kernel: add missing put_device()
  2023-07-18  7:26 ` [PATCH] sparc: kernel: add missing put_device() sunran001
@ 2023-07-18 15:02   ` Sam Ravnborg
  0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2023-07-18 15:02 UTC (permalink / raw)
  To: sunran001; +Cc: davem, sparclinux, linux-kernel

Hi Ran Sun,

On Tue, Jul 18, 2023 at 03:26:31PM +0800, sunran001@208suo.com wrote:
> The of_find_device_by_node() takes a reference to the underlying device
> structure, we should release that reference.
> 
> Detected by coccinelle with the following ERRORS:
> ./arch/sparc/kernel/pci_psycho.c:308:2-8: ERROR: missing put_device;
> call of_find_device_by_node on line 290, but without a corresponding
> object release within this function.
> ./arch/sparc/kernel/pci_psycho.c:350:0-1: ERROR: missing put_device;
> call of_find_device_by_node on line 290, but without a corresponding
> object release within this function.
> 
> Signed-off-by: Ran Sun <sunran001@208suo.com>
> ---
>  arch/sparc/kernel/pci_psycho.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
> index f413371da387..45f8370bbfad 100644
> --- a/arch/sparc/kernel/pci_psycho.c
> +++ b/arch/sparc/kernel/pci_psycho.c
> @@ -305,6 +305,7 @@ static void psycho_register_error_handlers(struct
> pci_pbm_info *pbm)
>       */
> 
>      if (op->archdata.num_irqs < 6)
> +        put_device(op->dev);
>          return;

Missing {}

	Sam

> 
>      /* We really mean to ignore the return result here.  Two
> @@ -347,6 +348,7 @@ static void psycho_register_error_handlers(struct
> pci_pbm_info *pbm)
>          PSYCHO_PCICTRL_EEN);
>      tmp &= ~(PSYCHO_PCICTRL_SBH_INT);
>      upa_writeq(tmp, base + PSYCHO_PCIB_CTRL);
> +    put_device(op->dev);
>  }
> 
>  /* PSYCHO boot time probing and initialization. */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-18 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230718072514.16432-1-xujianghui@cdjrlc.com>
2023-07-18  7:26 ` [PATCH] sparc: kernel: add missing put_device() sunran001
2023-07-18 15:02   ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®