[PATCH 16/38] mips: sgi-ip22: add missing put_device call

From: Levente Kurusa
Date: Thu Dec 19 2013 - 10:04:48 EST


This is required so that we give up the last reference to the device.

Also, create a gio_bus_release() that calls kfree on the device argument to
properly kfree() the memory allocated for the device.

Signed-off-by: Levente Kurusa <levex@xxxxxxxxx>
---
arch/mips/sgi-ip22/ip22-gio.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index ab0e379..931da33 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -24,8 +24,13 @@ static struct {
{ .name = "SGI GR2/GR3", .id = 0x7f },
};

+void gio_bus_release(struct device *dev) {
+ kfree(dev);
+}
+
static struct device gio_bus = {
.init_name = "gio",
+ .release = &gio_bus_release,
};

/**
@@ -400,8 +405,10 @@ int __init ip22_gio_init(void)
int ret;

ret = device_register(&gio_bus);
- if (ret)
+ if (ret) {
+ put_device(&gio_bus);
return ret;
+ }

ret = bus_register(&gio_bus_type);
if (!ret) {
--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/