linux-mips
[Top] [All Lists]

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

To: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 16/38] mips: sgi-ip22: add missing put_device call
From: Levente Kurusa <levex@linux.com>
Date: Thu, 19 Dec 2013 16:03:27 +0100
Cc: Levente Kurusa <levex@linux.com>, Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=k1AEIJDg1JZuqVd3qoJDzkAbN1Bsi/o94choHT3vcLQ=; b=sAfJhJkcKdJuw4Z093XwrHMuy7e5Y+Gbc9cURiPwXFh7y2/LhBxSGeha+9MagYoM8U JEzeryoCuNRkbHjOmysi1au+tjW2GFSLrX7aQOi9Ju3wx4NzITlgKFjMIKtI9LBKQoTi DtTMyyGYtz/1Qkb7diL0M+kCeiN0E5hnz7OvHr2DxxuC8Gd8yl1FWa9Sv7nFp4ECde7W P/dr7Ve8iPS3W0KA6KqWQI2ZvzWRKeWBAHNBmS4E/h3y86bnkHBPe0pOdXTfFw/wJfcm 6FRfK8HecjRlRgYVbo2PPcRy4QGC8yqUankLInj4nmIuuA1gYBawlu71+30CUy3XmXvg 2Kxw==
In-reply-to: <1387465429-3568-2-git-send-email-levex@linux.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1387465429-3568-2-git-send-email-levex@linux.com>
Sender: linux-mips-bounce@linux-mips.org
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@linux.com>
---
 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


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 16/38] mips: sgi-ip22: add missing put_device call, Levente Kurusa <=