diff options
author | Levente Kurusa <levex@linux.com> | 2013-12-19 10:03:26 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-07-30 07:27:51 -0400 |
commit | f0a7a2d042807d08e5bcfd3194e74b16810c4def (patch) | |
tree | a42c14bd9a29e36073b1317f749376596cfc05ef /arch/mips | |
parent | 1610c8a8f2d3eb5dac5a418356c179d28da4e74e (diff) |
MIPS: TXx9: 7segled: add missing put_device call
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.
[ralf@linux-mips.org: Reformat to Linux coding style and make
tx_7segled_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/6260/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/txx9/generic/7segled.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c index 4642f56e70e5..566c58bd44d0 100644 --- a/arch/mips/txx9/generic/7segled.c +++ b/arch/mips/txx9/generic/7segled.c | |||
@@ -83,6 +83,11 @@ static struct bus_type tx_7segled_subsys = { | |||
83 | .dev_name = "7segled", | 83 | .dev_name = "7segled", |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static void tx_7segled_release(struct device *dev) | ||
87 | { | ||
88 | kfree(dev); | ||
89 | } | ||
90 | |||
86 | static int __init tx_7segled_init_sysfs(void) | 91 | static int __init tx_7segled_init_sysfs(void) |
87 | { | 92 | { |
88 | int error, i; | 93 | int error, i; |
@@ -103,11 +108,14 @@ static int __init tx_7segled_init_sysfs(void) | |||
103 | } | 108 | } |
104 | dev->id = i; | 109 | dev->id = i; |
105 | dev->bus = &tx_7segled_subsys; | 110 | dev->bus = &tx_7segled_subsys; |
111 | dev->release = &tx_7segled_release; | ||
106 | error = device_register(dev); | 112 | error = device_register(dev); |
107 | if (!error) { | 113 | if (error) { |
108 | device_create_file(dev, &dev_attr_ascii); | 114 | put_device(dev); |
109 | device_create_file(dev, &dev_attr_raw); | 115 | return error; |
110 | } | 116 | } |
117 | device_create_file(dev, &dev_attr_ascii); | ||
118 | device_create_file(dev, &dev_attr_raw); | ||
111 | } | 119 | } |
112 | return error; | 120 | return error; |
113 | } | 121 | } |