All of lore.kernel.org
 help / color / mirror / Atom feed
From: yu kuai <yukuai3@huawei.com>
To: <john@phrozen.org>, <ralf@linux-mips.org>,
	<paulburton@kernel.org>, <jhogan@kernel.org>
Cc: <linux-mips@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<yukuai3@huawei.com>, <zhengbin13@huawei.com>,
	<yi.zhang@huawei.com>
Subject: [PATCH] MIPS: ralink: add missing put_device in ill_acc_of_setup
Date: Wed, 25 Dec 2019 21:15:20 +0800	[thread overview]
Message-ID: <20191225131520.2505-1-yukuai3@huawei.com> (raw)

If of_find_device_by_node return 0 and ill_acc_of_setup return error,
pdev don't have a corresponding object release.

Fix it by adding put_device.

Signed-off-by: yu kuai <yukuai3@huawei.com>
---
 arch/mips/ralink/ill_acc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/ralink/ill_acc.c b/arch/mips/ralink/ill_acc.c
index 0ddeb31afa93..bdf53807d7c2 100644
--- a/arch/mips/ralink/ill_acc.c
+++ b/arch/mips/ralink/ill_acc.c
@@ -67,11 +67,13 @@ static int __init ill_acc_of_setup(void)
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
 		dev_err(&pdev->dev, "failed to get irq\n");
+		put_device(&pdev->dev);
 		return -EINVAL;
 	}
 
 	if (request_irq(irq, ill_acc_irq_handler, 0, "ill_acc", &pdev->dev)) {
 		dev_err(&pdev->dev, "failed to request irq\n");
+		put_device(&pdev->dev);
 		return -EINVAL;
 	}
 
-- 
2.17.2


             reply	other threads:[~2019-12-25 13:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-25 13:15 yu kuai [this message]
2020-01-09 18:52 ` [PATCH] MIPS: ralink: add missing put_device in ill_acc_of_setup Paul Burton

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=20191225131520.2505-1-yukuai3@huawei.com \
    --to=yukuai3@huawei.com \
    --cc=jhogan@kernel.org \
    --cc=john@phrozen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paulburton@kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=yi.zhang@huawei.com \
    --cc=zhengbin13@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.