From: Levente Kurusa <levex@linux.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Levente Kurusa <levex@linux.com>,
Ralf Baechle <ralf@linux-mips.org>,
linux-mips@linux-mips.org
Subject: [PATCH 15/38] mips: txx9: 7segled: add missing put_device call
Date: Thu, 19 Dec 2013 16:03:26 +0100 [thread overview]
Message-ID: <1387465429-3568-16-git-send-email-levex@linux.com> (raw)
In-Reply-To: <1387465429-3568-2-git-send-email-levex@linux.com>
This is required so that we give up the last reference to the device.
Also, add a new tx_7segled_release function which will be called after the
put_device to ensure that device is kfree'd.
Signed-off-by: Levente Kurusa <levex@linux.com>
---
arch/mips/txx9/generic/7segled.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c
index 4642f56..3caa548 100644
--- a/arch/mips/txx9/generic/7segled.c
+++ b/arch/mips/txx9/generic/7segled.c
@@ -83,6 +83,10 @@ static struct bus_type tx_7segled_subsys = {
.dev_name = "7segled",
};
+void tx_7segled_release(struct device *dev) {
+ kfree(dev);
+}
+
static int __init tx_7segled_init_sysfs(void)
{
int error, i;
@@ -103,11 +107,14 @@ static int __init tx_7segled_init_sysfs(void)
}
dev->id = i;
dev->bus = &tx_7segled_subsys;
+ dev->release = &tx_7segled_release;
error = device_register(dev);
- if (!error) {
- device_create_file(dev, &dev_attr_ascii);
- device_create_file(dev, &dev_attr_raw);
+ if (error) {
+ put_device(dev);
+ return error;
}
+ device_create_file(dev, &dev_attr_ascii);
+ device_create_file(dev, &dev_attr_raw);
}
return error;
}
--
1.8.3.1
next prev parent reply other threads:[~2013-12-19 15:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1387465429-3568-2-git-send-email-levex@linux.com>
2013-12-19 15:03 ` [PATCH 14/38] mips: txx9: add missing put_device call Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa [this message]
2013-12-19 15:03 ` [PATCH 16/38] mips: sgi-ip22: " Levente Kurusa
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=1387465429-3568-16-git-send-email-levex@linux.com \
--to=levex@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.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