Skip to content

Commit

Permalink
MIPS: IP22: Add missing put_device call
Browse files Browse the repository at this point in the history
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.

[ralf@linux-mips.org: Reformat to Linux coding style and make
gio_bus_release static.]

Signed-off-by: Levente Kurusa <levex@linux.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6261/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Levente Kurusa authored and Ralf Baechle committed Jul 30, 2014
1 parent f0a7a2d commit 82242d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/mips/sgi-ip22/ip22-gio.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ static struct {
{ .name = "SGI GR2/GR3", .id = 0x7f },
};

static void gio_bus_release(struct device *dev)
{
kfree(dev);
}

static struct device gio_bus = {
.init_name = "gio",
.release = &gio_bus_release,
};

/**
Expand Down Expand Up @@ -413,8 +419,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) {
Expand Down

0 comments on commit 82242d2

Please sign in to comment.