mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sunran001@208suo.com
To: davem@davemloft.net
Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] sparc: kernel: add missing put_device()
Date: Tue, 18 Jul 2023 15:26:31 +0800	[thread overview]
Message-ID: <4125a3a7bda2d099b59e32e20f733a92@208suo.com> (raw)
In-Reply-To: <20230718072514.16432-1-xujianghui@cdjrlc.com>

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. */

       reply	other threads:[~2023-07-18  7:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230718072514.16432-1-xujianghui@cdjrlc.com>
2023-07-18  7:26 ` sunran001 [this message]
2023-07-18 15:02   ` Sam Ravnborg

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=4125a3a7bda2d099b59e32e20f733a92@208suo.com \
    --to=sunran001@208suo.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.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

all inboxes | Powered by JetHome®